Linux chown command

Sunny day out near Tokyo Station
Sunny day out near Tokyo Station

A few people have asked me to talk about some of the code I have been programming on websites including the site. I wasn’t sure where to start, so I thought whilst looking at a few photos of Tokyo I would explain a few of the programming problems that came up this week and how I solved them.

The photos were taken last week on a very hot sunny day for April, whilst I was out near Tokyo Station, a short walk from the Imperial Palace.

I am working on an Open Source software project with Nick, the founder of The project is called HotaruCMS and is a content management system for people who want to run their own website but don’t have time to program it all themselves.

I was trying to install a copy of the HotaruCMS code from the subversion (svn) code repository. Code is normally kept in a repository so that many people who are working together can all submit their code at the same time and then bring the whole project together as the pages you see on the screen. HotaruCMS is using as its svn. Assembla are actually featuring HotaruCMS on their site at the moment in their introduction page.

To get to the problem, I wanted to directly copy in the code from svn to my linux apache server. I used to program on Microsoft’s .NET platform and worked mainly on Windows Server with IIS. Now I am trying to learn fast how to use my dedicated linux server.

I found out that I could directly copy, or export, the code by using the following from the command line:

svn co .

the “co” command instead of the “export” command copies in all of the svn version information so I can easily update the site details later when new code is released.

I am using PuTTy as my software to connect and access the command line of the server. I could write about difficulties in setting this up, but I would probably need a week to explain the troubles. However, when it works, it works, and now it works !

I didn’t realize when typing in the command above because I had logged in as the admin for the whole server, and not just the site I was copying data to, that I had inadvertently set the wrong group permissions for the files, and now could not access the files from the web browser.

Users of linux may be familiar with the 3 digit file permissions commonly seen as 644, 666, 755, 777 etc. These can be changed with most FTP software and also with the “chmod” line command. These were not my problem though so I had to go looking for details on how to change the group owner.

I discovered that the command “chown” could make the changes i needed.

By entering

sudo find . -exec chown hotarupl:hotarupl {} ;

I was able to hunt down and change the files all to ownership of the site itself. The username “hotarupl” appears twice, once for the ownership state on the left of the “:”, and once for the group state on the right.

I thought this was the end of the problem, but discovered I still could not access the files. After much searching it turned out as well as changing the required files, I had also changed the “public_html” folder to be in the group of “hotarupl” when it should be in the group of “nobody”.

After changing back just the “public_html” folder’s group state to “nobody” the directory and files within it were now all accessible.

If you are not a programmer, most of this may seem strange to understand. I don’t expect articles on programming to be a regular feature of the site, but thought it might be interesting to sometimes share some of the problems and solutions that come up during my day when working on the back end of and other sites.

The next time you see a problem with, maybe if the site is down altogether, you can think of me madly typing in various commands to try and get things back to normal.

Hope you enjoy the photos from the Palace outer grounds.

About the author



Click here to post a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • This post is AWESOME! Nature & Computers! Best couple, EVAR!
    ps: & I can show the screencapture image when someone is around and then do “hanami@office” while I’m alone. 😉

  • Interesting post. Recently, I have been forced to use the chown command in my linux server. The Apache’s user ‘www-data’, is set in any file modified or created from the web (like a form), and If you want to manipulate it from any other user, you have to user chown!

    One question: what’s the name of the editor that is showing in the background of the screenshot?


  • I don’t do any coding, but it’s nice to read about the work that you do. I follow you on Twitter – used to on Facebook until that site got a serious “social” disease (no content from “friends), just virtual crap. Don’t work too hard . . . your photos are always a treat. Thanks, Richard.

  • Linux chown command, Japan Technology A combination of photos an computer code. A different combination.Like you said we don’t always see this type of article. But was a pleasant change of pace like Protocol Snow said. This the type of article that my wife would understand more than myself. Seeing she designed the site all by herself. I enjoy the photos as usual.
    Btw my wife and I want to thank you for posting the link of our new blog on your site. the day after the site crashed from so much traffic, server couldn’t handle it. took her quite a while to get it back. we are getting visitors linking from your website, stumbleupon and direct links.all of this exposure helps her overall rating in the search engines. Getting most of the hits from Japan, Singapore most of SE Asia also Europe, Austrailia and the USA.
    So i want to send out a huge Domo Arigato to you and everyone that is visiting. 🙂 I will try to keep up with the daily articles and such. Coming up with a theme for a Sunday article, i will try to do. But it is all work in progress.
    Ja mata ne