LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 01-01-2009, 08:26 PM   #1
jestinjoy
Member
 
Registered: May 2004
Location: India
Distribution: Ubuntu 9.04, Debian Lenny
Posts: 121

Rep: Reputation: 22
Talking giving root privilage to the user?


My linux user account needs root privilage to delete files from the pendrive(/mnt/auto/sda1) or to move contents to it.How should I give root privilage as far as accessing the pendrive is concerned?
 
Old 01-01-2009, 08:39 PM   #2
mohaas05
Member
 
Registered: Oct 2008
Posts: 41

Rep: Reputation: 16
If you are in the sudoers (you will be able to tell after using this if you are or not)

Code:
sudo <command>
Otherwise, just use

Code:
su -
to login as root.
 
Old 01-01-2009, 08:41 PM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by jestinjoy View Post
My linux user account needs root privilage to delete files from the pendrive(/mnt/auto/sda1) or to move contents to it.How should I give root privilage as far as accessing the pendrive is concerned?
Rather than doing so, you should be asking how to mount the device with the correct privileges so users can write on it. This depends in a number of things, starting with the type of file system and how you mount it.
 
Old 01-01-2009, 08:51 PM   #4
jestinjoy
Member
 
Registered: May 2004
Location: India
Distribution: Ubuntu 9.04, Debian Lenny
Posts: 121

Original Poster
Rep: Reputation: 22
re

Yes..........How should I do that.........
 
Old 01-01-2009, 09:10 PM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Well, the first thing is, how do you mount the drive?

The second thing is what file system did you use to mount it?

If you are not sure, post the contents of /etc/fstab, however that might not help if the system automounts the pen drive using some non-standard odd thing, like most do nowadays.
 
Old 01-01-2009, 09:14 PM   #6
jestinjoy
Member
 
Registered: May 2004
Location: India
Distribution: Ubuntu 9.04, Debian Lenny
Posts: 121

Original Poster
Rep: Reputation: 22
re

System auto mounts the pendrive at /mnt/auto/sda1.Can I edit fstab manually?

Quote:
/dev/sda1 /mnt/auto/sda1 auto rw,noauto 0 0
when I give this it said only root can do that.What should I do?

Last edited by jestinjoy; 01-01-2009 at 09:25 PM.
 
Old 01-01-2009, 09:26 PM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by jestinjoy View Post
System auto mounts the pendrive at /mnt/auto/sda1.Can I edit fstab manually?
Sure. But the whole thing comes down at one single problem: how is your OS mounting your drive?

If it's specified in /etc/fstab, then you should be able to edit /etc/fstab and be done with it. If it's a FAT32 file system, you need to look at the umask option (you probably want umask=000). For other fs's, the thing can be different. Check the mount man page:

Code:
man mount
Other common ways to mount stuff are ivman and udev rules. But first, let's check that fstab.
 
Old 01-01-2009, 09:31 PM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Well, you can try to add umask=000 to the list of options, not sure if that works with fs type "auto". So, try this:

Code:
/dev/sda1 /mnt/auto/sda1 auto rw,noauto,umask=000 0 0
If not, try

Code:
/dev/sda1 /mnt/auto/sda1 vfat rw,noauto,umask=000 0 0
Assuming that your pen drive is formatted with fat32. Fat32 volumes can't store linux permissions because they simply lack the structures to do so. So all the permissions are emulated at mount time, that's what umask does. A mask of 000 means that all the files will have permissions set to 777 (all permissions for all users).

As said, this is all related to vfat (and maybe ntfs, check the mount man page).
 
Old 01-01-2009, 09:33 PM   #9
jestinjoy
Member
 
Registered: May 2004
Location: India
Distribution: Ubuntu 9.04, Debian Lenny
Posts: 121

Original Poster
Rep: Reputation: 22
re

My fstab look like this.............

Quote:
/dev/hda2 / ext3 defaults 0 1
/dev/hda1 none swap sw 0 0
proc /proc proc defaults 0 0
/dev/fd0 /mnt/auto/floppy auto user,noauto 0 0
/dev/cdrom /mnt/auto/cdrom auto ro,user,noauto 0 0
/dev/sda1 /mnt/auto/sda1 auto user,noauto 0 0
 
Old 01-01-2009, 09:39 PM   #10
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Try to modify the sda1 line like I told you above and see if that makes a different. Remember that:
  • to modify fstab you need to be root, so use "sudo nano /etc/fstab"
  • for the changes to take effect you need to umount and mount again the volume
 
Old 01-01-2009, 09:52 PM   #11
jestinjoy
Member
 
Registered: May 2004
Location: India
Distribution: Ubuntu 9.04, Debian Lenny
Posts: 121

Original Poster
Rep: Reputation: 22
re

For the two commands I get the following error message..........

Code:
(exo-mount:8576): Gtk-WARNING **: Locale not supported by C library.
	Using the fallback 'C' locale.
mount: only root can mount /dev/sda1 on /mnt/auto/sda1
 
Old 01-01-2009, 09:57 PM   #12
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by jestinjoy View Post
For the two commands I get the following error message..........

Code:
(exo-mount:8576): Gtk-WARNING **: Locale not supported by C library.
	Using the fallback 'C' locale.
mount: only root can mount /dev/sda1 on /mnt/auto/sda1
I am not sure what are you doing. Did you already modify /etc/fstab? Either way, what exact command are you using to mount the drive?

If you want to be able to manually mount/umount stuff you might be interested in reading about the "users" mount option. In that case, your line in fstab would become:

Code:
/dev/sda1 /mnt/auto/sda1 auto rw,noauto,umask=000,users 0 0
 
Old 01-02-2009, 04:13 AM   #13
jestinjoy
Member
 
Registered: May 2004
Location: India
Distribution: Ubuntu 9.04, Debian Lenny
Posts: 121

Original Poster
Rep: Reputation: 22
re

My pendrive is automatically mounted. The above error message is found after editing fstab as said by you..........


I added the current user to the group ROOT. But that groupd didnt have the write permission on pendrive. WHat should be done on the group to give write permission on pendrive...........

Last edited by jestinjoy; 01-02-2009 at 04:15 AM.
 
Old 01-02-2009, 04:26 AM   #14
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by jestinjoy View Post
My pendrive is automatically mounted. The above error message is found after editing fstab as said by you..........
In your fstab line, try changing "user" by "user". I assume you also added the umask stuff. Then try this and see if it works as a normal user:

Code:
umount /mnt/auto/sda1
mount /mnt/auto/sda1
If it works, check if you can write something to the drive, for example:

Code:
touch /mnt/auto/sda1/test
If it works, then it should continue working on the next mounts. If it doesn't work then, please, give me the output of this command:

Code:
mount | grep sda1
Maybe it's not in fat32 after all.

Quote:
I added the current user to the group ROOT. But that groupd didnt have the write permission on pendrive. WHat should be done on the group to give write permission on pendrive...........
As said, it depends on the type of file system that you have. In fat32 you set the permissions at mount time, using umask. With linux file systems you set the permissions on the fs once it's mounted, using chmod/chown like with any other directory or regular file.
 
  


Reply

Tags
pendrive


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
Giving a user root permission via the root group louisb Linux - Security 6 07-23-2007 01:56 AM
giving root privilage to ordinary user... skie_knite007 Programming 5 09-13-2005 10:03 AM
Creating user in linux with the same or less privilage as root Tereno Linux - General 3 12-02-2004 07:36 AM
Creating user in linux with the same or less privilage as root sillyman Linux - General 2 12-01-2004 04:41 PM
Giving a User Root Privileges lawrencegoodman Linux - Newbie 4 12-23-2003 05:41 PM


All times are GMT -5. The time now is 08:47 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration