Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I cannot work this out. If I'm logged in as root (using chroot - possibly) then all my actions (e.g. mkdir) are assigned to the user root.

For my websites I need to associate files and directories and such to a specific user which appears to be linked to the virtual host account for the hosting account. (Its a dedicated hosting server - we log into the control panel and click "create account". This creates a new dir in /home with a www/public_html dir in it). For instance here is a screenshot of the www folder for one account:

enter image description here

I don't understand what its all about. The user appears to be 2045 however this is a number. Typing id 2045 into the command line results in id: 2045: No such user so does id "2045".

You can chown 2045:sites though, so I'm not entirely sure what's going on. Is 2045 a user? Or something else I don't know about?

What I really want to do is be able to switch user (su) to 2045 and run the commands so that I don't have to chown every time I do something (I work with SVN a lot).

Any insight would be very helpful. :) Thank you.

share|improve this question
up vote 2 down vote accepted

When ls -l shows a number instead of a group/user name, that is a UID/GID (User ID/Group ID). In your case, 2045 is a GID. You can get the user/group names (along with other information) using the following commands:

getent passwd UID
getent group GID


$ getent passwd 1000
andrea:x:1000:1000:Andrea Corbellini,,,:/home/andrea:/bin/bash
$ getent group 1000
share|improve this answer
Ah I see, thats cool. So these files and directories are owned by two groups? 2045 and sites? How can I run commands as the group 2045? – Thomas Clayson Mar 1 '12 at 10:17
No, it's owned by group 2045 and user sites. To run a command as a different group, you can use sudo -g group-name. In this case, as you don't have the group name but its ID, you should use sudo -g "#2045" (remember the quotes!). Note that you can specify both -g and -u at the same time. – Andrea Corbellini Mar 1 '12 at 18:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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