LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   file system permissions problem (https://www.linuxquestions.org/questions/linux-security-4/file-system-permissions-problem-300494/)

guy24x 03-11-2005 02:52 PM

file system permissions problem
 
hi,

i am trying to access my 2nd hard disk (/dev/hdb) from linux. i have added the entry in fstab as follows:

/dev/hdb2 /mnt/win_i vfat rw,users,exec 0 0

the permissions for this filesystem are as follows (when i do a ls -l in /mnt)

drwxr--r-- 6 root root 4096 Jan 1 1970 win_i/

i changed the permissions as follows as root:

chmod 0755 win_i

i also tried chmod ugo+x win_i

but when i do an ls -l, i find the permissions have not changed. so i basically cant enter into win_i except as root.

what could be the reason?! i would appreciate it if someone could tell me whats going on or what i'm not doing right...

btw, is changing permissions for directories the same procedure as changing permissions for files?

thanx,
guy24x

TruckStuff 03-11-2005 03:10 PM

Let's start with defining the problem. You say you have "file permission problems," but you don't say what you are trying to achieve. That's like saying "I'm having a problem wth this map" without saying where you are trying to go. ;)

guy24x 03-11-2005 03:15 PM

basically, i'm trying to cd into the directory win_i so that i can read certain files (like mp3 files) within. however, i find that i can cd into win_i only as root, and not as a normal user.

the permissions for the parent directory (/mnt) are as follows:

drwxr-xr-x 10 root root 4096 Mar 9 18:05 mnt/

the error i get when i try to cd into win_i as a normal user are as follows:

[test@system1 mnt]$ cd win_i
bash: cd: win_i: Permission denied

regards,
guy24x

TruckStuff 03-11-2005 04:09 PM

try
Code:

# chmod -R 755 /mnt/win_i/

guy24x 03-12-2005 01:02 AM

hi truck,

as u suggested, i tried:

[root@system1 mnt]# chmod -Rv 755 /mnt/win_i

and i did get the output that it changed the permissions of all files within win_i to 755, but when i do ls -l as a normal user, i still get the same status:

drwxr--r-- 6 root root 4096 Jan 1 1970 win_i/

and when i try to cd into win_i as a normal user, i get the same:

[test@system1 mnt]$ cd win_i
bash: cd: win_i: Permission denied

i unmounted win_i, deleted the directory win_i, and tried the procedure again as follows:

# umount /mnt/win_i
# rmdir win_i
#mkdir win_i

at this point, win_i has the 755 permissions.

immediately after i mount hdb2 onto win_i, the permissions change back to 744.

my umask value is 0022.

regards,
guy24x

jschiwal 03-12-2005 03:32 AM

You can't use the 'chmod' command on a mounted vfat partition. You need to use the umask= option instead. As an alternative, you can use the fmask= and dmask= options to give different permissions for files and directories. You probablly don't want files on this drive to be executable, so you could mask out the 'x' execution bit using fmask. However, the 'x' bit serves a different function for directories, so you would want it set.

Read through the 'man mount' man-page for all of the gory details!

There are other options you can use. For example, instead of the users option you can use 'uid=' and 'gid=' option. So if your username is 'guy24x' you could have 'uid=guy24x' as one of the options. This will make you the owner of the partition, and give you full access. If there is a 'guy24x' group also, you could use 'gid=guy24x'.

Something else you could do is create a group who's purpose is sharing this particular partition. Then making certain users members of the group would allow these users to share files there, but deny others access. This is what the group 'fileshare' is for. But you could create your own group.

Also, consider using the 'noexec' and 'nodev' option when mounting this drive.

guy24x 03-12-2005 04:38 AM

thank you so much jschiwal phewwwww :o

i was trying to figure out how to make this work for a month i guess !!!

as u mentioned, i did:

[root@system1 mnt]# mount -t vfat /dev/hdb2 win_i -o "uid=test"

and poof now i can enter win_i as a normal user (test) :D

thanx so much for the <timely> help :)

warm regards,
guy24x

(sometimes i think linux should be simpler to figure out ;-) the steep learning curve for newbies like me migrating from the m$ world gets pretty frustrating at times ! what do you feel?!)

jschiwal 03-15-2005 03:59 AM

At least there is a lot of documentation available for linux. Look in the www.tldp.org website for tons of howto's and guides.

Also, go to the mcc software installer and search for 'document'. There is a lot there.

I find it convenient to view man-pages and info-pages in the browser. From the konqueror address bar, or the application launcher enter man:<topic> or info:<topic>

You might consider installing 'webmin'. You can even partition drives there. If it is installed, point your browser to https://127.0.0.1:10000

There is also a cups web interface: http://localhost:631

Suppose you wanted to print out a man-page for a subject that you need to study, or for reference. You can produce a postscript file that can be viewed in kghostview or printed out: man -t fstab >fstab.ps . I find such a format makes it easier to read and remember. Also, you can refer to the printed page will trying it out on the console.

I agree that improvements could be made in the documentation. For example, in the documentation for Cups, perhaps an example on how on which group membership to add and how to set the password, so that you can make changes. Perhaps the distro's could produce better under-the-hood documentation explaining how everything fits together.

There are some excellent book available.
"The Linux Cookbook: Tips and Techniques for Everyday Use" by Michael Stuts.
"Running Linux", O'Reilly

For console commands, look at the 'info coreutils' pages. Many of the common commands found in /bin are documented there. There were written as a group and so many of them have common options.

Well, take care. I hope some of these tips are helpful.

guy24x 04-07-2005 06:09 PM

thank u so much jschiwal for the pointers...i will go thru more documentation b4 i crib that linux is tough!

thanx again,

guy24x

(p.s: sorry about the late reply)


All times are GMT -5. The time now is 03:03 AM.