You are not logged in.

#1 2025-11-14 13:32:43

Iulian
Member
Registered: 2019-08-01
Posts: 27

How do you mount things correctly?

I am trying to make an app that will mount inserted USB drives.

I had a hunch that the mount() function call would require admin rights for doing its job (its also written on the man page) but i decided to go on.

To me it seems like a server/client architecture is going to be needed.

Server waits for device to be mounted -> notifies a client running as user that gives it details on how to mount it -> the server mounts it accordingly

But it's not quite clear to me how the client and server should communicate. DBus doesn't really work since they don't have a commong bus (unless i misunderstood how dbus works)

Sockets sounds like a complication.

The idea was to have the DE/WM launch this on startup and have auto mounted drives

Offline

#2 2025-11-14 13:50:50

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,724

Re: How do you mount things correctly?

Most DEs have this functionality through udisks2.

Offline

#3 2025-11-14 14:04:20

Iulian
Member
Registered: 2019-08-01
Posts: 27

Re: How do you mount things correctly?

I know. i just want to build my own for some fun

Offline

#4 2025-11-14 14:28:38

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,086

Re: How do you mount things correctly?

And you probably want to follow the pack and therefore use udisks2 - have you looked into that?

DBus doesn't really work since they don't have a commong bus (unless i misunderstood how dbus works)

udisks listens on the sysystem bus, if your system has more than one of those, you've bigger problems than disk mounting tongue

Offline

#5 2025-11-14 14:54:02

Iulian
Member
Registered: 2019-08-01
Posts: 27

Re: How do you mount things correctly?

No i dont have more than 1 system session i was talking about system/user session. I guess i could connect to both.

I mainly need the user session to emit notifications when one drive was mounted.

I just want to build something for fun, why do you have to shove udisks down my throat

Offline

#6 2025-11-14 14:59:07

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,086

Re: How do you mount things correctly?

I just want to build something for fun, why do you have to shove udisks down my throat

Nobody did? Scimmia pointed out what's common and you had not prima-face ruled that out.
You'll need some other leverage, either polkit, sudo or sth. like pmount was common ages ago.

Offline

#7 2025-11-14 19:32:12

cryptearth
Member
Registered: 2024-02-03
Posts: 2,094

Re: How do you mount things correctly?

seth wrote:

You'll need some other leverage, either polkit, sudo or sth. like pmount was common ages ago.

well - going out of my comfort zone: why would a user-session daemon require root privileges itself if all it does is to communicate with some service running as root via typical IPC like a socket?
given OP write two parts - as they wrote one part running as system service with root privileges and another one running as user-application without I don't see any issue when these two parts communicate over a socket - or does a non-privileged connection to a socket running in privileged level to be privileged as well (which would somewhat defeat the idea of IPC)?

Offline

#8 2025-11-14 19:37:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,086

Re: How do you mount things correctly?

why would a user-session daemon require root privileges itself if all it does is to communicate with some service running as root via typical IPC like a socket?

Afaiu the OP they explicitly do NOT want to use udisks.
You'll need something running UID0 to do the mounting (or an fstab entry)

given OP write two parts - as they wrote one part running as system service with root privileges and another one running as user-application

… they would essentially have re-invented udisks.

Offline

Board footer

Powered by FluxBB