Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-05-2005, 10:05 PM   #1
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Rep: Reputation: 30
Mount / Script Question

I would like to create a script that will mount my ipod and then run gtkpod all in one shot.

The problem is that the mount command requires root priveleges. Is there anyway I can make the script autologin as root? Thanks!
Old 07-05-2005, 10:50 PM   #2
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Is there anyway I can make the script autologin as root?
Bad, bad, bad idea

In short, no, there's no way for a script to run with root priviledges unless root executes it. The script can run "su" inside to gain root priviledge, but that will require user interaction to enter the root password. In my opinion, aside from the annoyance of entering the password everytime you run the script, having a script gain root privledges is a bad call. It would be better to use sudo for this.

Actually, you can eliminate all this root priviledge business by editing your /etc/fstab file. If you add "user" to the comma-separated list of options for your ipod entry, then a regular (i.e. non-root) user can mount and unmount the device at will. Here's an example using the entry I have for a USB pendrive:
/dev/pendrives/lexar      /media/pendrive  vfat     noauto,rw,user          0     0
Given that, your script becomes (with the mountpoint changed appropriately of course):

mount /media/pendrive
And that's it.


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
How to write a script for automatic mount Kalyani1 Linux - Software 34 11-03-2005 03:16 PM
How to create script to mount / unmount drive rollo Linux - Newbie 8 08-01-2005 05:39 AM
Startup script to mount windows shares? Higs Linux - Networking 1 05-30-2004 09:28 AM script to mount CD and run .bin file kulkarni08 Linux - General 2 06-24-2003 01:01 PM
SCRIPT: check if auto-mount mount-points are still mounted markus1982 Linux - Software 0 05-25-2003 05:48 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:21 PM.

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