I am running CentOS 4 and have the need to run "mount -t cifs ..." from within a perl or bash script as part of an application. The application does not run as root. I have been trying to do a chmod +s on a root owned script but that doesn't seem to work. I still get permission errors. I also took a look at sudo but that appears to require a user to periodically enter a password. This would not work for this application. Does anyone have any suggestions on how to do a mount from a script based application not being run as root? Thanks for your help. Mike __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
On 28/04/06, Michael Jacks <michael_jem at yahoo.com> wrote:> I am running CentOS 4 and have the need to run "mount -t cifs ..." from > within a perl or bash script as part of an application. The > application does not run as root. I have been trying to do a chmod +s > on a root owned script but that doesn't seem to work. I still get > permission errors. I also took a look at sudo but that appears to > require a user to periodically enter a password. This would not work > for this application. > > Does anyone have any suggestions on how to do a mount from a script > based application not being run as root?You can allow a user to run a command without entering a password using sudo. Simplistically, something like the following in /etc/sudoers (use visudo to edit it): Host_Alias SERVERNAME = server1 User_Alias USER = username Cmnd_Alias COMMAND1 = /bin/mount -t cifs USERNAME SERVERNAME = NOPASSWD: COMMAND1 Would enable user "username" to run the command "/bin/mount -t cifs" on server server1 as root by entering: [username at server ~]$ sudo /bin/mount -t cifs Will.
On Fri, 28 Apr 2006, Michael Jacks wrote:> I am running CentOS 4 and have the need to run "mount -t cifs ..." from > within a perl or bash script as part of an application. The > application does not run as root.If I remember right, suid scripts just can't be done securely. Can you use the automounter? If it's set up correctly, your script can get the filesystem mounted by simply doing an "ls". -David