Page 1 of 1

permissions

Posted: Mon Mar 11, 2013 1:09 am
by tevil
So I set up an ext4 thumb drive For torrenting and now somehow the permissions have gotten all screwed up and I can't get them to reset using the GUI and I'm not familiar with the command line so would someone be able to tell me how to set full permissions for everyone. Thanks.

PS
This all happened after seeing up samba

Re: permissions

Posted: Mon Mar 11, 2013 7:57 am
by DBryant
To change ownership use chown and to change permissions chmod; you can only change permissions for which you can claim ownership.

See their relevant man-pages, at http://linux.die.net/man/1/chown and http://linux.die.net/man/1/chmod if you don't have them installed locally.

An an example, to take ownership of all files in the pi-user's filesystem

Code: Select all

chown -R pi:pi /home/pi
This sets both user and group perrmissions to pi, and does it recursively down the directory tree.

To change permissions then
chmod 775 /home/pi/myScript.sh
chmod og+x /home/pi/myScript.sh
Where the first uses a numerical mask to set permissions to rwx for the scripts for owner and group; the second example increments added the execute permission for owner and group for the same file. Obviously you you one or the other and not both, depending on what makes most sense to use (and your users).

You say messed up, depending on your definition of 'messed', this could also be a result of the mounting of the filesystem which follows the configuration in the /etc/fstab file. Not really messed up but ownership may well be different from your expectations and you may not be able to write to a file when you might otherwise expect to. Search this forum for numerous experiences of this, where you will see a lot associated with the use of Samba which makes an effort to map Windows style ownership/perms to those of Unix. It can be made to work but it generally a right pain in the rear-end!

Hope this helps.

Re: permissions

Posted: Mon Mar 11, 2013 12:11 pm
by tevil
DBryant wrote:To change ownership use chown and to change permissions chmod; you can only change permissions for which you can claim ownership.

See their relevant man-pages, at http://linux.die.net/man/1/chown and http://linux.die.net/man/1/chmod if you don't have them installed locally.

An an example, to take ownership of all files in the pi-user's filesystem

Code: Select all

chown -R pi:pi /home/pi
This sets both user and group perrmissions to pi, and does it recursively down the directory tree.

To change permissions then
chmod 775 /home/pi/myScript.sh
chmod og+x /home/pi/myScript.sh
Where the first uses a numerical mask to set permissions to rwx for the scripts for owner and group; the second example increments added the execute permission for owner and group for the same file. Obviously you you one or the other and not both, depending on what makes most sense to use (and your users).

You say messed up, depending on your definition of 'messed', this could also be a result of the mounting of the filesystem which follows the configuration in the /etc/fstab file. Not really messed up but ownership may well be different from your expectations and you may not be able to write to a file when you might otherwise expect to. Search this forum for numerous experiences of this, where you will see a lot associated with the use of Samba which makes an effort to map Windows style ownership/perms to those of Unix. It can be made to work but it generally a right pain in the rear-end!

Hope this helps.
I actually tried that chown script but it still shows ownership of the folders under transmission-daemon and says operation not permitted. Im trying to get it back to pi or just everyone so I can delete old stuff in there. It will not let me delete anything as of now.
Ill try again with those other 2 lines as well. I tried searching around but there are so many different threads about thumb drives that they dont seem to relate to mine since most are people formatting them fat or ntfs and not ext.
Yeah I know about windows permissions systems and linux/unix style can be a major pain. I used to run a few ubuntu servers in my house along xp and 7 and they were consistently trouble with file sharing.
I really just wanted to let the thumb drive be open to everyone since there is nothing on it and most of my usage is just through my nexus 7 and I dont even log into the pi except ssh if needed for reboots.
thanks for the help, Ill try the other lines.

instant update-
I logged in via vnc and started a root terminal instead of doing it via ssh and somehow it seemed to work for now.
thanks a lot.

Re: permissions

Posted: Mon Mar 11, 2013 1:06 pm
by DBryant
chown is a command not a script, as is chmod for that matter.

Your original post refers to 'seeing up' samba, I assume you mean 'setting up'. If so, why? Samba allows a Unix box to export filesystems to a Windows box, but Windows wouldn't be able to see ext4 anyway. If you want to export ext4 across your local Unix network then I'd stick to NFS.

I fear just trying the other commands tends to be a temporary fix at best. It might work but then a re-mount will set it back again; quite frustrating.

To mount a drive such that any can read/write to it then this should do it:

Code: Select all

sudo mount -o umask=0 /dev/whatever /mnt/your_mount_point
Umask set as 0 means files are created with 777 permissions (i.e the 1's complement of 0) meaning owner, group and world can do anything.
In /etc/fstab an entry would be something like

Code: Select all

/dev/whatever /mnt/your_mount_point auto users,noatime,umask=0 0 0
But this really depends on how or what is mounting the drive since it could alternatively be part of the udev sub-system.