permissions - changing the ownership of a folder in linux - Stack Overflow (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (Stack Overflow) (https://stackoverflow.com/opensearch.xml) (https://stackoverflow.com/questions/21951556/changing-the-ownership-of-a-folder-in-linux) (site logo) Join Stack Overflow By clicking “Sign up”, you agree to our (https://stackoverflow.com/legal/terms-of-service/public) terms of service and acknowledge you have read our (https://stackoverflow.com/legal/privacy-policy) privacy policy . Sign up with Google Sign up with GitHub OR Email Password (8+ characters (at least 1 letter & 1 number)) Sign up Already have an account? (https://stackoverflow.com/users/login) Log in Skip to main content (https://stackoverflow.com/) Stack Overflow (https://stackoverflow.co/) About Products (https://stackoverflow.co/teams/ai/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav-bar&utm_content=overflowai) OverflowAI (Search…) (Click to show search) (https://stackoverflow.com/users/login?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f21951556%2fchanging-the-ownership-of-a-folder-in-linux) Log in (https://stackoverflow.com/users/signup?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f21951556%2fchanging-the-ownership-of-a-folder-in-linux) Sign up Let's set up your homepage Select a few topics you're interested in: python javascript c# reactjs java android html flutter c++ node.js typescript css r php angular next.js spring-boot machine-learning sql excel ios azure docker Or search from our full list: (Search) Next You’ll be prompted to create an account to view your personalized homepage. (https://stackoverflow.com/) Home (https://stackoverflow.com/questions) Questions (https://stackoverflow.com/tags) Tags (https://stackoverflow.com/beta/discussions) Discussions Labs (https://chat.stackoverflow.com/?tab=all&sort=active) Chat (https://stackoverflow.com/users) Users (https://stackoverflow.com/jobs?source=so-left-nav) Jobs (https://stackoverflow.com/jobs/companies?so_medium=stackoverflow&so_source=SiteNav) Companies Collectives Communities for your favorite technologies. (https://stackoverflow.com/collectives-all) Explore all Collectives Teams Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflowteams.com/teams/create/free/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Try Teams for free (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Explore Teams (Illustration of upvote icon after it is clicked) Hang on, you can't upvote just yet. You'll need to complete a few actions and gain 15 reputation points before being able to upvote. Upvoting indicates when questions and answers are useful. (https://stackoverflow.com/help/whats-reputation) What's reputation and how do I get it? Instead, you can save this post to reference later. Save this post for later Not now (Illustration of upvote icon after it is clicked) Hang on, you can't downvote just yet. You'll need to complete a few actions and gain 125 reputation points before being able to downvote. Casting downvotes indicate issues with quality, effort, or accuracay of a post. (https://stackoverflow.com/help/whats-reputation) What's reputation and how do I get it? Instead, you can try suggesting an edit to improve the post. Suggest edit No thanks (Illustration of upvote icon after it is clicked) Hang on, you can't upvote just yet. You'll need to complete a few actions and gain 15 reputation points before being able to upvote. Upvoting indicates when questions and answers are useful. (https://stackoverflow.com/help/whats-reputation) What's reputation and how do I get it? To start gaining reputation, try answering a related question. linux permissions chmod chown file-ownership Find related question Not now (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (https://stackoverflow.com/questions/21951556/changing-the-ownership-of-a-folder-in-linux) changing the ownership of a folder in linux [closed] (https://stackoverflow.com/questions/ask) Ask Question (2014-02-22 08:03:34Z) Asked 11 years, 2 months ago Modified (https://stackoverflow.com/questions/21951556/changing-the-ownership-of-a-folder-in-linux?lastactivity) (2023-10-04 13:29:15Z) 1 year, 6 months ago (Viewed 315,567 times) Viewed 316k times This question shows research effort; it is useful and clear 71 (This question does not show any research effort; it is unclear or not useful) Save this question. (https://stackoverflow.com/posts/21951556/timeline) Show activity on this post. Closed. This question does not meet (https://stackoverflow.com/help/closed-questions) Stack Overflow guidelines . It is not currently accepting answers. This question does not appear to be about (https://stackoverflow.com/help/on-topic) a specific programming problem, a software algorithm, or software tools primarily used by programmers . If you believe the question would be on-topic on (https://stackexchange.com/sites) another Stack Exchange site , you can leave a comment to explain where the question may be able to be answered. Closed (2014-02-22 17:28:04Z) 11 years ago . (https://stackoverflow.com/posts/21951556/edit) Improve this question I have a folder in my subdomain which is created through WHM so the owner of that subdomain is not the owner of main domain. I want to change the owner of one of the folders of subdomain to domain owner. I tried this, but when I check with winscp it shows owner as 500. chown users:user /home/xyz/somnething/photo/ I've tried to change from winscp also, but there is no option for winscp, so I've logged in as root using putty and ran the command from above, but it doesn't help and I am unable to upload any file to subdomain from the main domain, as it returns 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 the ownership of rohan to sujit to have rights to upload file from sujit domain to subdomain rohan Update: Now it is changing owner to 500 (https://stackoverflow.com/questions/tagged/linux) (show questions tagged 'linux') linux (https://stackoverflow.com/questions/tagged/permissions) (show questions tagged 'permissions') permissions (https://stackoverflow.com/questions/tagged/chmod) (show questions tagged 'chmod') chmod (https://stackoverflow.com/questions/tagged/chown) (show questions tagged 'chown') chown (https://stackoverflow.com/questions/tagged/file-ownership) (show questions tagged 'file-ownership') file-ownership (https://stackoverflow.com/q/21951556) (Short permalink to this question) Share (https://stackoverflow.com/posts/21951556/edit) Improve this question Follow Follow this question to receive notifications (https://stackoverflow.com/posts/21951556/revisions) (show all edits to this post) edited (2023-10-04 13:29:15Z) Oct 4, 2023 at 13:29 (https://stackoverflow.com/users/18174166/avijit-dey) (Avijit Dey's user avatar) (https://stackoverflow.com/users/18174166/avijit-dey) Avijit Dey (reputation score) 123 (1 gold badge) 1 1 gold badge (1 silver badge) 1 1 silver badge (10 bronze badges) 10 10 bronze badges asked (2014-02-22 08:03:34Z) Feb 22, 2014 at 8:03 (https://stackoverflow.com/users/3340072/sachin) (sachin's user avatar) (https://stackoverflow.com/users/3340072/sachin) sachin sachin (reputation score) 797 (1 gold badge) 1 1 gold badge (5 silver badges) 5 5 silver badges (11 bronze badges) 11 11 bronze badges 1 (number of 'useful comment' votes received) 1 chown -R username:group directory – (https://stackoverflow.com/users/1521771/underscore) (6,907 reputation) underscore Commented (2014-02-22 08:08:33Z, License: CC BY-SA 3.0) Feb 22, 2014 at 8:08 (Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.) Add a comment | (Expand to show all comments on this post) 1 Answer 1 Sorted by: (https://stackoverflow.com/questions/21951556/changing-the-ownership-of-a-folder-in-linux?answertab=scoredesc#tab-top) Reset to default (scoredesc) Highest score (default) (trending) Trending (recent votes count more) (modifieddesc) Date modified (newest first) (createdasc) Date created (oldest first) This answer is useful 131 (This answer is not useful) Save this answer. (Loading when this answer was accepted…) (https://stackoverflow.com/posts/21951679/timeline) Show activity on this post. Use chown to change ownership and chmod to change rights. use the -R option to apply the rights for all files inside of a directory too. Note that both these commands just work for directories too. The -R option makes them also change the permissions for all files and directories inside of the directory. For example sudo chown -R username:group directory will change ownership (both user and group) of all files and directories inside of directory and directory itself. sudo chown username:group directory will only change the permission of the folder directory but will leave the files and folders inside the directory alone. you need to use sudo to change the ownership from root to yourself. Edit: Note that if you use chown user: file (Note the left-out group), it will use the default group for that user. Also You can change the group ownership of a file or directory with the command: chgrp group_name file/directory_name You must be a member of the group to which you are changing ownership to. You can find group of 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) has 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 which 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, the 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 really 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'm willing to bet it comes back as 1000 for you. (https://stackoverflow.com/a/21951679) (Short permalink to this answer) Share (https://stackoverflow.com/posts/21951679/edit) Improve this answer Follow Follow this answer to receive notifications (https://stackoverflow.com/posts/21951679/revisions) (show all edits to this post) edited (2014-02-22 08:41:07Z) Feb 22, 2014 at 8:41 answered (2014-02-22 08:16:48Z) Feb 22, 2014 at 8:16 (https://stackoverflow.com/users/3150853/jayesh-bhoi) (Jayesh Bhoi's user avatar) (https://stackoverflow.com/users/3150853/jayesh-bhoi) Jayesh Bhoi Jayesh Bhoi (reputation score 25,981) 26k (17 gold badges) 17 17 gold badges (62 silver badges) 62 62 silver badges (75 bronze badges) 75 75 bronze badges 16 sudo chown -R username:group directory here username is my owner name? an group is? – (https://stackoverflow.com/users/3340072/sachin) (797 reputation) sachin Commented (2014-02-22 08:23:03Z, License: CC BY-SA 3.0) Feb 22, 2014 at 8:23 (number of 'useful comment' votes received) 7 @sachin if you only give user name then user ownership is changed while group ownership unchanged.so try sudo chown -R username directory – (https://stackoverflow.com/users/3150853/jayesh-bhoi) (25,981 reputation) Jayesh Bhoi Commented (2014-02-22 08:25:17Z, License: CC BY-SA 3.0) Feb 22, 2014 at 8:25 it is giving chown: invalid group: `sujit:group' – (https://stackoverflow.com/users/3340072/sachin) (797 reputation) sachin Commented (2014-02-22 08:26:08Z, License: CC BY-SA 3.0) Feb 22, 2014 at 8:26 (number of 'useful comment' votes received) 1 @sachin remove :group if you not know group name.Also look my updated answer. – (https://stackoverflow.com/users/3150853/jayesh-bhoi) (25,981 reputation) Jayesh Bhoi Commented (2014-02-22 08:29:07Z, License: CC BY-SA 3.0) Feb 22, 2014 at 8:29 now it is changing owner to 500 – (https://stackoverflow.com/users/3340072/sachin) (797 reputation) sachin Commented (2014-02-22 08:30:22Z, License: CC BY-SA 3.0) Feb 22, 2014 at 8:30 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) | (Expand to show all comments on this post) Show 11 more comments Start asking to get answers Find the answer to your question by asking. (https://stackoverflow.com/questions/ask) Ask question Explore related questions (https://stackoverflow.com/questions/tagged/linux) (show questions tagged 'linux') linux (https://stackoverflow.com/questions/tagged/permissions) (show questions tagged 'permissions') permissions (https://stackoverflow.com/questions/tagged/chmod) (show questions tagged 'chmod') chmod (https://stackoverflow.com/questions/tagged/chown) (show questions tagged 'chown') chown (https://stackoverflow.com/questions/tagged/file-ownership) (show questions tagged 'file-ownership') file-ownership See similar questions with these tags. The Overflow Blog (https://stackoverflow.blog/2025/04/28/how-self-supervised-language-revolutionized-natural-language-processing-and-gen-ai/?cb=1) (How self-supervised language revolutionized natural language processing and gen AI) How self-supervised language revolutionized natural language processing and... (https://stackoverflow.blog/2025/04/29/we-re-not-replacing-you-we-re-with-you-where-ai-meets-infrastructure/?cb=1) “We’re not replacing you; we’re with you”: Where AI meets infrastructure Featured on Meta (Meta Stack Exchange) (https://meta.stackexchange.com/questions/408576/updates-to-advertising-guidelines?cb=1) Updates to advertising guidelines (Meta Stack Exchange) (https://meta.stackexchange.com/questions/408584/evolving-comments-an-experiment-to-encourage-engagement-and-follow-up-questions?cb=1) Evolving comments: An experiment to encourage engagement and follow-up questions (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/421831/policy-generative-ai-e-g-chatgpt-is-banned?cb=1) Policy: Generative AI (e.g., ChatGPT) is banned (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/433648/discussions-learnings-and-potential-next-steps?cb=1) Discussions learnings and potential next steps (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/433720/2025-developer-survey-call-for-feedback?cb=1) 2025 Developer Survey: Call for Feedback Related (https://stackoverflow.com/q/16956810?rq=1) (Question score (upvotes - downvotes)) 7672 (https://stackoverflow.com/questions/16956810/find-all-files-containing-a-specific-text-string-on-linux?rq=1) Find all files containing a specific text (string) on Linux? (https://stackoverflow.com/q/5947742?rq=1) (Question score (upvotes - downvotes)) 2829 (https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux?rq=1) How to change the output color of echo in Linux (https://stackoverflow.com/q/226703?rq=1) (Question score (upvotes - downvotes)) 1911 (https://stackoverflow.com/questions/226703/how-do-i-prompt-for-yes-no-cancel-input-in-a-linux-shell-script?rq=1) How do I prompt for Yes/No/Cancel input in a Linux shell script? (https://stackexchange.com/questions?tab=hot) Hot Network Questions (Blender Stack Exchange) (https://blender.stackexchange.com/questions/334013/geometry-nodes-used-to-generate-wall-layouts) Geometry Nodes used to generate wall layouts (Christianity Stack Exchange) (https://christianity.stackexchange.com/questions/106100/the-blood-of-christ-does-the-bible-anywhere-put-its-saving-power-in-the-same-ca) The Blood of Christ: does the Bible anywhere put its saving power in the same category as Christ perfectly keeping the law for believers? (Politics Stack Exchange) (https://politics.stackexchange.com/questions/91566/why-did-it-take-7-years-for-the-european-commission-to-launch-legal-proceedings) Why did it take 7 years for the European Commission to launch legal proceedings against Malta’s ‘golden passport’ scheme? (Cryptography Stack Exchange) (https://crypto.stackexchange.com/questions/114936/why-was-the-value-of-modulus-q-chosen-small-in-kyber-and-large-in-dilithium) Why was the value of modulus (q) chosen small in KYBER and large in DILITHIUM? (Unix & Linux Stack Exchange) (https://unix.stackexchange.com/questions/794364/how-to-read-a-line-from-a-file-and-output-the-line-to-a-file) How to read a line from a file and output the line to a file (Academia Stack Exchange) (https://academia.stackexchange.com/questions/218199/applying-to-math-graduate-school-with-a-scarred-transcript) Applying to math graduate school with a scarred transcript (Chess Stack Exchange) (https://chess.stackexchange.com/questions/46932/why-is-qxb2-so-much-better-than-bxb2) Why is Qxb2 so much better than Bxb2? (Law Stack Exchange) (https://law.stackexchange.com/questions/108490/is-termination-of-employment-for-refusal-to-work-overtime-legal) Is termination of employment for refusal to work overtime legal? (MathOverflow) (https://mathoverflow.net/questions/491818/function-to-measure-consonance-and-dissonance-in-musical-tones) Function to measure consonance and dissonance in musical tones (Puzzling Stack Exchange) (https://puzzling.stackexchange.com/questions/131662/reindeer-cryptic-crossword) Reindeer cryptic crossword (Philosophy Stack Exchange) (https://philosophy.stackexchange.com/questions/124651/what-are-the-rhine-experiments-their-purpose-and-significance) What are the Rhine Experiments, Their Purpose, and Significance? (Bicycles Stack Exchange) (https://bicycles.stackexchange.com/questions/96691/magene-p505-power-meter-paywall) Magene P505 power meter paywall (Mathematica Stack Exchange) (https://mathematica.stackexchange.com/questions/312395/boids-by-simon-woods-can-we-re-invent-further-efficient-flocking-models-to-forg) Boids by Simon Woods: can we re-invent further efficient flocking models to forge complexity from simple rules? (Academia Stack Exchange) (https://academia.stackexchange.com/questions/218198/length-of-response-to-referee-report) Length of response to referee report? (Information Security Stack Exchange) (https://security.stackexchange.com/questions/281185/what-is-the-drawback-of-always-generating-passphrases-for-the-user) What is the drawback of always generating passphrases for the user? (Academia Stack Exchange) (https://academia.stackexchange.com/questions/218195/my-work-is-being-read-but-not-used-what-can-i-improve) My work is being read but not used — what can I improve? (Electrical Engineering Stack Exchange) (https://electronics.stackexchange.com/questions/744997/modeling-constant-power-load-with-ac-source-in-ltspice) Modeling Constant Power Load with AC Source in LTspice (Quantitative Finance Stack Exchange) (https://quant.stackexchange.com/questions/82417/what-is-stopping-trader-taking-arbitarge-in-hkd-usd) What is stopping trader taking arbitarge in HKD-USD (Mathematica Stack Exchange) (https://mathematica.stackexchange.com/questions/312444/retrieving-connected-components-from-list-of-neighbors) Retrieving connected components from list of neighbors (Cross Validated) (https://stats.stackexchange.com/questions/664750/glmm-of-sparse-microbial-data-with-a-high-number-of-observations-shows-some-devi) GLMM of sparse microbial data with a high number of observations shows some deviation in DHARMa plots? (Data Science Stack Exchange) (https://datascience.stackexchange.com/questions/131809/rounding-float-values-in-ml-models) Rounding Float Values in ML Models (Physics Stack Exchange) (https://physics.stackexchange.com/questions/848666/what-is-induced-atmospheric-vibration) What is "Induced Atmospheric Vibration"? (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/741663/fill-a-space-made-by-three-arcs) Fill a space made by three arcs (Mathematics Stack Exchange) (https://math.stackexchange.com/questions/5060916/integro-differential-equation-of-one-function-of-one-variable-with-periodic-cond) Integro-differential equation of one function of one variable with periodic condition () (https://stackoverflow.com/) (https://stackoverflow.com/) Stack Overflow (https://stackoverflow.com/questions) Questions (https://stackoverflow.com/help) Help (https://chat.stackoverflow.com/?tab=site&host=stackoverflow.com) Chat (https://stackoverflow.co/) Products (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=teams) Teams (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=advertising) Advertising (https://stackoverflow.co/advertising/employer-branding/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=talent) Talent (https://stackoverflow.co/) Company (https://stackoverflow.co/) About (https://stackoverflow.co/company/press/) Press (https://stackoverflow.co/company/work-here/) Work Here (https://stackoverflow.com/legal) Legal (https://stackoverflow.com/legal/privacy-policy) Privacy Policy (https://stackoverflow.com/legal/terms-of-service/public) Terms of Service (https://stackoverflow.com/contact) Contact Us Your Privacy Choices (https://stackoverflow.com/legal/cookie-policy) Cookie Policy (https://stackexchange.com/) Stack Exchange Network (https://stackexchange.com/sites#technology) Technology (https://stackexchange.com/sites#culturerecreation) Culture & recreation (https://stackexchange.com/sites#lifearts) Life & arts (https://stackexchange.com/sites#science) Science (https://stackexchange.com/sites#professional) Professional (https://stackexchange.com/sites#business) Business (https://api.stackexchange.com/) API (https://data.stackexchange.com/) Data (https://stackoverflow.blog/?blb=1) Blog (https://www.facebook.com/officialstackoverflow/) Facebook (https://twitter.com/stackoverflow) Twitter (https://linkedin.com/company/stack-overflow) LinkedIn (https://www.instagram.com/thestackoverflow) Instagram Site design / logo © 2025 Stack Exchange Inc; user contributions licensed under (https://stackoverflow.com/help/licensing) CC BY-SA . rev 2025.4.29.25832 By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our (https://stackoverflow.com/legal/cookie-policy) Cookie Policy . Accept all cookies Necessary cookies only Customize settings