chmod a freshly mounted external drive to set up writing access

蹲街弑〆低调 提交于 2019-12-04 03:21:58
Balaji Perumal

Try this first,

umount /dev/sdb1

chmod -R 0777 /mnt/external   

then mount with

mount /dev/sdb1 /mnt/external

or try

chmod -R 0777 /mnt/external

chmod -R 777 /mnt/external

No need to specify the device. You chmod the directory recursively.

However, usually external drives are formatted with FAT32 or some sort of Windows-compatible file system, which does not have POSIX / UNIX permissions. So this step may be redundant.

How is your drive formatted?

Have you tried writing to it as a non-root user?

A solution posted on behalf of the OP.

Update:

linux-wyee:/mnt # chown martin:users /mnt/external

See the results: - it is obvious that it works ;-)

martin@linux-wyee:/> cd mnt
martin@linux-wyee:/mnt> ls -l
insgesamt 4
drwxr-xr-x 3 root root 4096 13. Dez 19:43 external
martin@linux-wyee:/mnt> su
Passwort:
linux-wyee:/mnt # ^C
linux-wyee:/mnt #

linux-wyee:/mnt # chown martin:users /mnt/external

linux-wyee:/mnt # cd mnt
bash: cd: mnt: Datei oder Verzeichnis nicht gefunden
linux-wyee:/mnt # ls -l
insgesamt 4
drwxr-xr-x 2 martin users 4096 13. Dez 22:01 external
linux-wyee:/mnt #

It works as you see now the user martin has got permissions.

chmod -R 0777 /mnt/external

This seems to be excessive for me. Everyone on this machine can execute whatever he wants from external disk. A wide opened door for hackers. They can e.g. save a picture using a web form, change execute bit and run it as a script on your system.

Perhaps, rw access for owner and group and r for others would be a better option.

I had a similar problem, but the solution for me was to use the uid and gid options of the CIFS filing system. (I had to use CIFS because apparently NFS doesn't allow access via username and password, which I needed.)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!