LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Running a mount script on login (https://www.linuxquestions.org/questions/linux-software-2/running-a-mount-script-on-login-761313/)

targettl 10-12-2009 04:43 AM

Running a mount script on login
 
I am trying to build an image for an educational enviroment where Debian will be used as the OS.

mount -t cifs //Newtrinity/Users/$USER $HOME/Desktop/u.drive -o username=$USERNAME,password=$PASSWORD

This command command does not work because a $PASSWORD variable does not exist. I need this so a user can login and have their network drives mapped automatically without having to input any extra information. Anyone know a variable that I can use or how to create one?

Also to mount with this command you need to be root. How can I allow users to have permission to mount there drives when they login. I have tried SUID set user id but this does work for this scenario.
chmod 6777 script
chmod 6777 /sbin/mount.cifs

Apparantly allowing scripts to run as root is a security risk so they are ignored and the mount.cifs, well just doesn't do much either. It does work for things like fdisk though. I have been inserting the script path in /etc/profile to make it run which only executes sometimes. By the way security is not a concern so please leave those statements out thanks.

William (Dthdealer) 10-12-2009 05:17 AM

The pmount package will allow users to mount media without root privileges.

repo 10-12-2009 05:21 AM

Quote:

This command command does not work because a $PASSWORD variable does not exist. I need this so a user can login and have their network drives mapped automatically without having to input any extra information. Anyone know a variable that I can use or how to create one?
Create a script, and set the variable password

Code:

PASSWORD=123456
mount -t cifs //Newtrinity/Users/$USER $HOME/Desktop/u.drive -o username=$USERNAME,password=$PASSWORD


targettl 10-12-2009 04:23 PM

PASSWORD=123456 will not work as it is a variable that will change as all users will have different login passwords
pmount can only mount local filesystem can't it?

chrism01 10-12-2009 07:19 PM

Try autofs http://linux.die.net/man/5/autofs


All times are GMT -5. The time now is 12:18 PM.