Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)

I have the folder in the subdomain which is created through WHM so the owner of that subdomain is not the owner of my main domain.

I want to change my owner of one of my folders of the subdomain to the domain owner. I tried this, but when I check with the WinSCP it shows the owner as 500.

chown users:user /home/xyz/somnething/photo/

I have tried to change the WinSCP also, but there is no option for WinSCP, so I have logged in as the root using the putty and ran the command from above, but it doesn't help and I am unable to upload any file to the subdomain from one main domain, as it returns the error "permission denied".

$ ls -l /home/xyz/somnething/photo/

total 8 

drwxr-xr-x 2 sujit sujit 4096 Feb 21 23:39 ./ 

drwxr-x--- 5 rohan nobody 4096 Feb 22 02:28 ../ 

I want to give ownership of the Rohan to  the sujit to have these rights to upload the file from the Sujit domain to the subdomain Rohan

Update:

Now it is changing the owner to 500

1 Answer

0 votes
by (36.8k points)
edited by

Use the chown to change the ownership and to change rights. use the -R option to apply these rights for all the files inside of the directory too.

Note that both the commands just work for directories too. The -R option makes them also change these permissions for all the files and directories inside of the directory.

For example

sudo chown -R username:group directory

will change the ownership (both user and group) of all the files and directories inside the directory and directory itself.

sudo chown username:group directory

will only change this permission of a folder directory but will leave these files and folders inside a directory alone.

you need to use this sudo to change the ownership from root to yourself.

Edit:

Note that if you use a chown user: file (Note the left-out group), it will use a default group for that user.

Also You can change this group ownership of the file or directory with the command:

chgrp group_name file/directory_name

You must be a member of a group to which you are changing ownership to.

You can find a group of the file as follows

# ls -l file

-rw-r--r-- 1 root family 0 2012-05-22 20:03 file

# chown sujit:friends file

User 500 is just a normal user. Typically user 500 was the first user on the system, recent changes (to /etc/login.defs) have altered the minimum user id to 1000 in many distributions, so typically 1000 is now the first (non root) user.

What you may be seeing is a system that has been upgraded from the old state to the new state and still has some processes knocking about on uid 500. You can likely change it by first checking if your distro should indeed now use 1000, and if so alter the login.defs file yourself, renumber the user account in /etc/passwd and chown/chgrp all their files, usually in /home/, then reboot.

But in answer to your question, no, you should not be worried about this in all likelihood. It'll be showing as "500" instead of a username because o user in 

/etc/passwd has a uid set of 500

 that's all.

Also, you can show your current numbers using id I am willing to bet it comes back as 1000 for you.

Want to be a Linux expert? Come and join this Linux course

Related questions

0 votes
1 answer
0 votes
1 answer
asked Dec 12, 2020 in Linux by blackindya (18.4k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...