Stuart Bird wrote:
> The first way is to use: gksudo nautilus to access and edit files as 
> root. The second way is to add myself to the root group which then 
> allows me full control from my normal users account.
> 
> Can anyone advise if these are viable (ie safe) long term solutions or 
> should I keep searching for a better way.

Are you logged into Gnome when you attach the external drive, or do you 
have it plugged in when you switch on?

If you have it plugged in when you switch on, it won't know who to mount 
it as, and may default to root; you may need to write an /etc/fstab rule 
for the external drive with uid=youruserid and/or gid=yourgroup . For 
example, my username is aoakley, so to mount a FAT external drive at 
boot time, I might write an /etc/fstab rule like:

/dev/sdb /media/mymountpoint vfat rw,uid=aoakley 0 0

Beware that not all external hard drives are VFAT! Some may be NTFS or 
somesuch.

Alternatively I might use umask to make it read/writable to everyone 
within a particular group:

/dev/sdb /media/mymountpoint vfat rw,umask=007 0 0

...which would make it read/writable to everyone in the root group, or:

/dev/sdb /media/mymountpoint vfat rw,gid=aoakley,umask=007 0 0

...which would make it read/writable to everyone in aoakley's group, or:

/dev/sdb /media/mymountpoint vfat rw,umask=000 0 0

...which would make it owned by root but read/writable to everyone, even 
guest users (INSECURE!).

(Stop reading now if you attach the drive before the machine is switched 
on, or if you always leave the drive plugged in. The following only 
apply if you attach the drive AFTER you log in to Gnome.)

Newly plugged-in USB drives AFTER you have logged in to Gnome should 
automatically be mounted as the logged-in user (eg. aoakley for myself) 
and root as the group.

Have you got more than one user logged into Gnome perhaps? This might 
cause confusion.

For example, I log in to Gnome and insert a 1GB USB key, so I get:

$ cat /etc/mtab
...
/dev/sdb /media/AO\0401GB vfat 
rw,nosuid,nodev,shortname=mixed,uid=1000,utf8,umask=077,usefree 0 0
$ ls -l /media
total 28
drwx------ 10 aoakley root 16384 1970-01-01 01:00 AO 1GB
...

The last line shows that the user is aoakley (my local logged-in user) 
and the group is root.

If you aren't getting this, then either you're not using Gnome 
Automount, or something is wrong with Gnome Automount. Have you written 
an /etc/fstab entry which is overruling Gnome Automount? If so, try 
commenting it out.

Is automount running? Check for gnome-v* processes, you should see two; 
gnome-volume-manager and gnome-vfs-daemon . If not, something is wrong 
with your gnome start-up sequence (too complex to discuss here).

$ sudo ps -e | grep gnome-v
5600 ?        00:00:00 gnome-volume-ma
5630 ?        00:00:00 gnome-vfs-daemo

Check your Gnome Automount preferences in System - Preferences - 
Removable Drives And Media - Removable Storage - Mount Removable Drives 
When Hot Plugged TICKED - Mount Removable Media When Inserted TICKED.

Check your Gnome Automount configuration in (Alt-F2) - gconf-editor - 
System - Storage . Check that there is NOT some special rule for your 
hard drive. Then check under Default Options - (Your storage type) and 
make sure that the uid= config is either not present, or blank.

For instance, my gconf-editor - System - Storage - Default Options - 
VFat - mount_options shows:

[shortname=mixed,uid=,utf8,umask=077,exec,usefree]

The important bit there is "uid=" (uid equals empty) which defaults to 
the currently logged-in user in Gnome.

-- 
Andrew Oakley


-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.kubuntu.org/UKTeam/

Reply via email to