LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-12-2009, 04:43 AM   #1
targettl
Member
 
Registered: Sep 2009
Location: Launceston
Distribution: Kubuntu
Posts: 84

Rep: Reputation: 16
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.
 
Old 10-12-2009, 05:17 AM   #2
William (Dthdealer)
Member
 
Registered: Jan 2009
Location: Sydney, Australia
Distribution: Debian Testing
Posts: 99
Blog Entries: 39

Rep: Reputation: 19
The pmount package will allow users to mount media without root privileges.
 
Old 10-12-2009, 05:21 AM   #3
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
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
 
Old 10-12-2009, 04:23 PM   #4
targettl
Member
 
Registered: Sep 2009
Location: Launceston
Distribution: Kubuntu
Posts: 84

Original Poster
Rep: Reputation: 16
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?
 
Old 10-12-2009, 07:19 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,873

Rep: Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600
Try autofs http://linux.die.net/man/5/autofs
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possibel to halt script running at login to root? n3mbers Linux - Newbie 11 07-22-2009 07:25 PM
Bash script not running on shell login. uncle-c Linux - Newbie 8 02-21-2009 09:41 AM
Running Script Upon Login edwin11 Linux - Software 7 06-26-2006 04:24 AM
Running a script at user login? brucebearau Debian 1 01-19-2004 04:28 AM
SCRIPT: check if auto-mount mount-points are still mounted markus1982 Linux - Software 0 05-25-2003 05:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration