Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear keepers of wisdom,
I'm trying to write a perl program to allow users to mount removable media and Samba shares into their own home directory. The script shall enforce certain options and will not allow file systems, which cannot be squashed to the user, i.e. support uid,gid options. The program has suid root and uses the perl-suid interpreter. The system is a Debian Lenny Linux.
The program basically works nicely, except for a crucial detail
user$ ./hmount --usb= ~/mnt Real uid: 1000 Effective uid: 0 whoami> root INFO: Attached sda: (sda1 sda2 sda3) on USB bus 16:0:0:0 mount: only root can do that
As can be seen from the debugging output EUID is 0, which is confirmed by a forked whoami. mount obviously considers the program as non-root. This is how I call this mount:
system("$cmd_mount -t $fs -o $mand_opt $dev $mountpath");Since Google produces a lot of hits indicating that Perl shall be the choice for such mount scripts, but does not produce a good example, I guess that this issue should be nothing principle.
Could you initiate me to the blessings of perl-suid?
|
|---|