![]()  | 
| 
 Set chown and chmod in external HDD - Printable Version +- Linux-Noob Forums (https://www.linux-noob.com/forums) +-- Forum: Linux Noob (https://www.linux-noob.com/forums/forum-3.html) +--- Forum: How Do I? (https://www.linux-noob.com/forums/forum-60.html) +--- Thread: Set chown and chmod in external HDD (/thread-414.html) Pages: 
1
2
 
 | 
Set chown and chmod in external HDD - leonardo - 2010-10-29 Hi at all, I connected an external HDD. I need to set permissions, user and group. If I type commands chmod and chown I can not set them. How do I do? If I type "fdisk -l" the result is: Code: 255 heads, 63 sectors/track, 182401 cylindersThankyou in advance for your help and sorry for my English Set chown and chmod in external HDD - Dungeon-Dave - 2010-10-29 "chown" and "chmod" set permissions on *nix filesystems, such as EXT2, EXT3, EXT4, ReiserFS, JFS, etc. Code: /dev/sdb1               1      182401  1465135448+   c  W95 FAT32 (LBA)As you can see there, the filesystem is FAT32, which doesn't honour *nix permissions. If, on the other hand, you want to allow ordinary users to read/write to that external HDD, there are mount options that allow the disk to be "owned" by another user, which permits non-root access. By the way - your English is fine. Much better than many English speakers I've seen on Facebook/Youtube! Set chown and chmod in external HDD - leonardo - 2010-10-29 Hi Dungeon-Dave, thank You for your replay. I mounted the external HDD with this command Code: mount -t vfat -o rw,umask=0000 /dev/sdb1 /backupCan you give me an indication of the command? Thank You very very much for your help Set chown and chmod in external HDD - Dungeon-Dave - 2010-10-29 Code: mount -t vfat -o rw,umask=0000,uid=500,gid=700 /dev/sdb1 /backupThat will mount it as the user specified by UID 500 and group ownership GID 700. The mount point won't be "owned" by root anymore, so user 500 can read/write to that filesystem happily. (substitute these with your UID and GID - use the "id" command to return what they are) For more information, try "man mount" to see options for the mount command. Hope that helps! (one final point: you can put this information in the /etc/fstab file so that a normal user can also perform the mount, rather than root having to do it) Set chown and chmod in external HDD - leonardo - 2010-10-29 Hi Dungeon-Dave, I Type Code: id adminThis is the result: uid=501(admin) gid=501(admin) gruppi=501(admin) I Type Code: mount -t vfat -o rw,umask=0000,uid=501,gid=501 /dev/sdb1 /backupI connect to SSH with admin but if I type "mkdir /backup/test" the result is "Permission denied" How can I fix this problem? Set chown and chmod in external HDD - Dungeon-Dave - 2010-10-29 Worked okay for me without the -t option (and the umask option). What do you see if you type in "mount" or "ls -ald /backups" - look at the permissions of that first. Set chown and chmod in external HDD - leonardo - 2010-10-29 If I type "ls -ald /backup" the result is "drwxr-xr-x 7 root root 32768 27 ott 13:30 /backup" user and group is root, but should be admin o_Oo_O I've try: #umount -l /backup/ #mkdir /backup #chown admin:admin /backup #mount -t vfat -o rw,umask=0000,uid=501,gid=501 /dev/sdb1 /backup but if I type "ls -ald /backup" the result is "drwxr-xr-x 7 root root 32768 27 ott 13:30 /backup" [img]<___base_url___>/uploads/emoticons/default_mad.gif[/img]o_O[img]<___base_url___>/uploads/emoticons/default_ohmy.png[/img] Set chown and chmod in external HDD - Dungeon-Dave - 2010-10-31 It looks like the "umount -l" is not working, or rather, not actually dismounting the volume. You shouldn't need to use "mkdir" to create the directory if it already exists. Try the following: "mount" - check that it isn't mounted. "ls -ald /backup" - check the permissions "mount -o uid=501,gid=501 /dev/sdb1 /backup" - should mount the USB pen "ls -ald /backup" - check the ownership again. This should now reflect "admin:admin". Set chown and chmod in external HDD - leonardo - 2010-10-31 Hi Dungeon-Dave, I've type thath commands: #mount (to check if /backup is mounted) #rm -rf backup (for delete the backup directory) #mkdir /backup;chown admin:admin /backup (to create the backup directory) #ls -ald /backup (for check user and group of backup directory) #mount -o uid=501,gid=501 /dev/sdb1 /backup (for mount the external HDD) #ls -ald /backup the final result: drwxr-xr-x 7 root root 32768 27 ott 13:30 /backup o_Oo_Oo_Oo_O Set chown and chmod in external HDD - Dungeon-Dave - 2010-10-31 Can you post the output of your "mount" and "df" commands at all?  |