LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-05-2005, 10:05 PM   #1
Centinul
Member
 
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
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Quote:
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:
Code:
/dev/pendrives/lexar      /media/pendrive  vfat     noauto,rw,user          0     0
Given that, your script becomes (with the mountpoint changed appropriately of course):
Code:
#!/bin/bash

mount /media/pendrive
gtkpod
And that's it.
 
  


Reply



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
Autorun.sh 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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:14 PM.

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