# /etc/fstab



## chadderbox4 (Jul 1, 2004)

ok.... I had this posted before the server crash...

I am trying to write to a vfat partion i have. I can with root and from 3 windows computers over the network. But, not from my user (chad) account that i am using. 

LABEL=/ / ext3 defaults 1 1
/dev/hdb1 /C vfat auto,user 0 0
/dev/hda2 /D vfat defaults 0 0
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/hda5 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 user,unhide,noauto,owner,kudzu,ro 0 0
/dev/cdrom1 /mnt/cdrom1 udf,iso9660 user,unhide,noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0

i switched /dev/hdb1 /C vfat auto,user 0 0 from /dev/hdb1 /C vfat default 0 0
and i still can't write to it.

any suggestions?


----------



## Skie (Mar 15, 2003)

Here's what I have for mien:

/dev/hda2 /windows/D vfat users,gid=users,umask=0002,iocharset=utf8 0 0


----------



## chadderbox4 (Jul 1, 2004)

I'll give it a try.

What does the users,gid=users,umask=0002,iocharset=utf8 part mean? I know that it allows all users but what is the umask=0002, iocharset=utf8?

Thanks
Chad

I copy and pasted your code into my file and i restarted the computer after saving... I still can't write the the drive. 

I get the error "Access Deined /C/Directory"when i try to create a directory calld Directory. Also when i try to move a direcotry to /C i get the same access denied error.


----------



## Skie (Mar 15, 2003)

The umask means that any file/dir that's created is automatically given permissions of 777. Basically, the umask is a reverse of what's actually given. 

Try this: 

cat /etc/passwd | grep <put your username here>

read the line that's returned, it should look something similar to this:

skie:x:1000:100:Skie:/home/skie:/bin/bash

If you look at the 4th column, you'll see a 100. This is my group ID (GID). Now do the following:

vi /etc/group

Scroll through this and pay attention to the 3rd column until you see this same group ID. The first column will be the name of the group. Make sure that the GID that you're using in fstab is the same as the GID for your user. 

Next, do the following:

chown root.<your group name here> /C

On my machine, it would look like this:

chown root.users /C (yes, the period must be there betweeen "root" and "users")

Finally: 

chmod 774 /C

See if this makes a difference.


----------



## chadderbox4 (Jul 1, 2004)

Ok i tried all that and come up with nothing. 
I copied and pasted everything:

[chad[email protected] chad]$ su
Password:
[[email protected] chad]# cat /etc/passwd | grep chad
chad:x:500:0:Chad Schroeder:/home/chad:/bin/bash
[[email protected] chad]#

/etc/groups
root:x:0:root,chad
bin:x:1:root,bin,daemon
daemon:x:2:root,bin,daemon
sys:x:3:root,bin,adm
adm:x:4:root,adm,daemon,chad
tty:x:5:
disk:x:6:root
lp:x:7:daemon,lp
mem:x:8:
kmem:x:9:
wheel:x:10:root
mail:x:12:mail
news:x:13:news
uucp:x:14:uucp
man:x:15:
games:x:20:
gopher:x:30:
dip:x:40:
ftp:x:50:
lock:x:54:
nobody:x:99:
users:x:100:
slocate:x:21:
nscd:x:28:
rpm:x:37:
floppy:x:19:
vcsa:x:69:
ntp:x:38:
utmp:x:22:
named:x:25:
apache:x:48:
sshd:x:74:
rpc:x:32:
rpcuser:x:29:
nfsnobody:x:65534:
mailnull:x:47:
smmsp:x:51:
squid:x:23:
pcap:x:77:
webalizer:x:67:
desktop:x:80:
xfs:x:43:
gdm:x:42:
chad:x:500:adm,chad,root
wine:x:66:

[[email protected] chad]# chown root.chad /C
chown: changing ownership of `/C': Operation not permitted
[[email protected] chad]#

[[email protected] chad]# chmod 774 /C
chmod: changing permissions of `/C' (requested: 0774, actual: 0775): Operation not permitted


----------



## Skie (Mar 15, 2003)

Edit your /etc/passwd file and for your username, put 500 instead of 0. I consider it a bad idea for the user to be part of the root group (group 0) as you'd be allowed to access/modify/delete files that only root should. You can edit the /etc/groups file and add yourself to the "wheel" group which will allow you to use "su". Did you add yourself to the root group? If not, which Distro are you using so I can avoid it? 

Try unmounting /C by using "umount /C". Make sure you're not using any of the files on that mount point. You can use "lsof /C" to find out if you are. Once it's unmounted and you've set your group to be 500, try using the chown command again. Since the chmod is already set to 775 for /C, you should be able to skip that step. 

If you still have problems, I'll take a look and see if I can come up with anything. But as long as you have proper permissions for that mount point, you should be able to write to it.


----------



## chadderbox4 (Jul 1, 2004)

wow, i am so lost.

here is /etc/passwd:

root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0perator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
rpm:x:37:37::/var/lib/rpm:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
named:x:25:25:Named:/var/named:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin
sshd:x:74:74rivilege-separated SSH:/var/empty/sshd:/sbin/nologin
rpc:x:32:32ortmapper RPC user:/:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
squid:x:23:23::/var/spool/squid:/sbin/nologin
pcap:x:77:77::/var/arpwatch:/sbin/nologin
webalizer:x:67:67:Webalizer:/var/www/html/usage:/sbin/nologin
desktop:x:80:80:desktop:/var/lib/menu/kde:/sbin/nologin
xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin
gdm:x:42:42::/var/gdm:/sbin/nologin
chad:x:500:4:Chad Schroeder:/home/chad:/bin/bash

Can't i just go to users and groups and change everything in the gui? i


----------



## Skie (Mar 15, 2003)

I'm not familiar with the GUI that you're using. But all you'd need to do is edit this line:

from:
chad:x:500:4:Chad Schroeder:/home/chad:/bin/bash

to: 
chad:x:500:500:Chad Schroeder:/home/chad:/bin/bash


----------



## chadderbox4 (Jul 1, 2004)

I changed it to 500:500 and i am still not able to write. I went back though the entire post and still nothing. I am thinking that there might be another problem. 

Yes, i did add myself to the root group. i figured that it would allow me to write the the directory. 

Thanks for you help and paitence.


----------



## Skie (Mar 15, 2003)

How about this. Unmount /C, then mount it as your user. I'm thinking that if it's been mounted by root, this could be the problem. Although, adding yourself to the root group should've fixed it, but then, stranger things have happened.


----------



## chadderbox4 (Jul 1, 2004)

Man this is crazy. I umount /dev/C and it doesn't say anything (which i think is good) but i can see go to it and see my files. (still unable to write to them though.) so i try to mount /dev/C and says it cannot be found. 

LOL this is more of a hassle than anything. It seems like i should beable to write to the drive because i was in the root group... period... but i guess not. 

Well i guess it could be worse!


----------



## Skie (Mar 15, 2003)

Don't add "/dev" to the mount command. /dev/C doesn't exist as far as I can tell. It's either "/dev/hdb1" or "/C".


----------



## kickass (Jul 3, 2004)

chadderbox4 said:


> *I am trying to write to a vfat partion i have. I can with root and from 3 windows computers over the network. But, not from my user (chad) account that i am using. ...
> 
> /dev/hdb1 /C vfat auto,user 0 0
> /dev/hda2 /D vfat defaults 0 0
> ...


ok this might work but im not to good at linux yet so bare with me if im wrong 

but i have this for my vfat partition in the /etc/fstab file: /dev/hda6 /mnt/win_d vfat umask=0,iocharset=iso8859-1,codepage=850 0 0

now as you know change /dev/hda6 with what ever you partition is and /mnt/win_d with where you whant to mount the partition. than restart the computer yaya
and then see if it works


----------



## chadderbox4 (Jul 1, 2004)

Skie said:


> *Don't add "/dev" to the mount command. /dev/C doesn't exist as far as I can tell. It's either "/dev/hdb1" or "/C". *


Hey man, Thank you so much for helping me. I unmounted the drive correctly this time... remounted it and i CAN write to it now. I just have a question... When i restart my computer will it go back to the way it was before and will i have to umount and mount it before i can write again?


----------



## Skie (Mar 15, 2003)

I'm pretty sure that it *will* go back to the way it was when you reboot. The trick to getting this to work the way you want it will be to figure out how to modify your /etc/fstab properly. I think what was happening was that the C: drive was being mounted by root, and therefore, you weren't allowed to write to it. 

I'm not sure why you're having issues with what you've entered into your /etc/fstab. Can you copy/paste it again (with the changes you've made recently). I'd like to see what it looks like right now.


----------



## kickass (Jul 3, 2004)

ok i tryed it on my system i changed my /etc/fstab file to look sort of like yours well it looks like this
/dev/hda6 /mnt/win_d vfat defaults 0 0
and now only root (not the root group) can change or even look in that mount point
and i changed it back and i could assess and modify most files on it.
and it dose not change durring restart at least it did not for me, but you will need to be root to modify it as you shuld know


----------



## chadderbox4 (Jul 1, 2004)

LABEL=/ / ext3 defaults 1 1
/dev/hdb1 /C vfat users,gid=users,umask=0002,iocharset=utf8 0 0
/dev/hda2 /D vfat users,gid=users,umask=0002,iocharset=utf8 0 0
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/hda5 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 user,unhide,noauto,owner,kudzu,ro 0 0
/dev/cdrom1 /mnt/cdrom1 udf,iso9660 user,unhide,noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
i can still write to /C and /D which is good. 

I haven't restarted my computer though. But to my understanding i will only have to umount and re mount them. How can i automount them durning boot time?


----------



## Skie (Mar 15, 2003)

Try the following and see if it does anything for you after a reboot...

/dev/hdb1 /C vfat user,gid=chad,umask=0002,iocharset=utf8 0 0
/dev/hda2 /D vfat user,gid=chad,umask=0002,iocharset=utf8 0 0

Notice the "user" instead of "users".


----------



## chadderbox4 (Jul 1, 2004)

sweet! It automounts during boot and allows me to write to it! Thank you so much
Chad


----------



## Skie (Mar 15, 2003)

Glad to get you working


----------

