I have a Raspberry Pi that's running a Raspbmc distribution and I've noticed that a lot of the directories are either owned by the user 501 and the group dialout or both the user and group root. It's frustrating for me to move files from the main filesystem on the SD card to the external drive because I always need root access (and it makes automating tasks a pain too), so I'd really like to be able to chown it to the user pi. I've read up a little bit on what the 501 user and the dialout group are and don't see why I shouldn't do this, but my knowledge of Unix permissions is basic at best so I'd like to know if I've missed any considerations before I go ahead and change the permissions recursively on the entire drive.

So my question would be: Is there any harm in doing a chown -R pi on the external drive?


If you create a common user between the systems where this disk is moving you can then make the ownership on this disk that single user and you'll no longer have to deal with this.

Simply add a user on both systems, and make sure that this user's UID (user ID) and GID (group ID) are the same numbers on both systems. The names are immaterial, it's the numbers that need to be kept in sync, so that the UID/GID is recognized across both systems as a single user/group.

When creating a user these are the parts that drive the recognition by the system which user/group owns files.


Say I have this directory, it's user/group is saml & saml.

$ ls -ld .
drwx------. 245 saml saml 32768 Oct 26 22:41 .

Using the -n switch to ls you can see what the numbers are for these fields.

$ ls -ldn .
drwx------. 245 500 501 32768 Oct 26 22:41 .

So we need to make sure that I have the same user/group on both systems (saml/saml) and the UID/GID needs to be 500/501 as well.

If you look in the /etc/group file you'll see the group saml + GID.

$ grep "^saml" /etc/group

Looking in /etc/passwd file you'll see the user saml + UID.

$ grep "^saml" /etc/passwd
saml:x:500:501:Sam M. (local):/home/saml:/bin/bash

When running the useradd command you can control what UID/GID to use.

$ sudo useradd -u 500 -g 501 saml
  • @ysim - you can also upvote in addition to accepting 8-) – slm Nov 4 '13 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.