Find the answer to your Linux question:
Results 1 to 10 of 10
I installed Linux (Fedora 10) for the first time yesterday and am having some problems which seem to be related to file permissions. When I installed Fedora I created some ...
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Posts
    4

    Help "cannot stat" Error When Copying Files

    I installed Linux (Fedora 10) for the first time yesterday and am having some problems which seem to be related to file permissions. When I installed Fedora I created some partitions including one which I mounted to /games. After installing a few applications I tried to install nQuake to my /games partition but I kept getting permission denied messages. Experimenting a bit more I found I couldn't copy any files to /games and would get the error:

    cp: cannot stat `/games/filename': Permission denied

    After searching around for a while I found about permissions and read an article explaining them. The permissions for the /games directory were drwxr-xr-x so I should have been able to copy files there as su but still got permission denied. As su I did "chmod 666 games" after which the permissions changed to drw-rw-rw- but despite that I still can't put any files in /games or do anything at all there either as myself or as su.

    In the end I gave up and put nQuake in my home directory. After installing it I tried to copy my config.cfg file from an NTFS Games partition to my nQuake installation in my home directory. Sadly the same error came up:

    cp: cannot stat `/home/Richard/nQuake/ezquake/configs/config.cfg': Permission denied

    I did the chmod 666 on my configs directory after which the permissions changed to drw-rw-rw- but I still got the same error.

    I searched for "cp: cannot stat" but most of the results seem to be related to shell scripting and go above my head. One says that cannot stat means that the directory doesn't exist but in both cases the directory most definately does exist.

    Can anbody tel me what's going wrong?

  2. #2
    Linux Newbie
    Join Date
    Feb 2009
    Location
    Third ring of Pergatory
    Posts
    199
    ls -l the files and find out if your current user owns them. The article you read may not have been clear but the permissions normaly tied to "failed to stat" have more to do with ownership than rwx status.
    There are several other reasons they might fail to stat, but that seems the most likely cause from your post

  3. #3
    Just Joined!
    Join Date
    Mar 2009
    Posts
    4
    Thanks a lot for the reply. Ownership was the problem and after changing ownership I can now copy files to the directories and partitions.

    Unfortunately I've created another problem. I seem to have done something to my nQuake configs directory (plus a few others) while trying to make them accessible and I can't even enter the directory with my profile. I don't know what I've done but it's caused the directories to get a coloured background. Here's how it shows up in the terminal:

    drw-rw-rw- 2 Richard root 4096 2009-03-21 06:25 configs

    Here's a screenshot of the terminal with configs shown:

    http://i44.tinypic.com/ayltt5.png

    Any idea what I've done?

    I think I need to buy a book to learn this stuff. I'm a disaster zone at the moment

  4. #4
    Linux Newbie
    Join Date
    Feb 2009
    Location
    Third ring of Pergatory
    Posts
    199
    The thing I'm noticing Richard is the group who owns those files it still root. Try chown Richard:users.
    I think I need to buy a book to learn this stuff. I'm a disaster zone at the moment
    Naaa, your doing fine, You're chmoding and chowning like a hardcore slackhead, just keep hammering on the keys, You remember what they said about a hundred monkeys on a hundred typewriters in a hundred years will write the collected works of Shakespeare,
    You don't need no stinking book, Richard. Re-installations, that's how real men do it!

  5. #5
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568
    Use -R chmod or chown,to change permission of entire files.

    chown -R oss:oss /home/oss/dir_name
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  6. #6
    Just Joined!
    Join Date
    Mar 2009
    Posts
    4
    Quote Originally Posted by dijetlo View Post
    The thing I'm noticing Richard is the group who owns those files it still root. Try chown Richard:users.
    Origionally they were all "root root" but after doing the chown they all became "Ricahrd root" and the tuturial I read said the first name was the owner so I thought I was the owner. I did the chown Richard:users and they're now all "Richard: users":

    http://i44.tinypic.com/25gtle8.png

    Unfortunately I still can't get into the configs directory which still has a coloured background. As you can see at the top of the screenshot it just says "Permission denied". I don't know what I did to it but I've done the same thing to quite a few directories and it won't let me into any of them. Any ideas?

    Thanks for the help.

    Quote Originally Posted by Lakshmipathi
    Use -R chmod or chown,to change permission of entire files.
    Thanks for for the reply. I found the recursive switch when I read about chown and used it to change the ownership of all the files in the Quake directory. Unfortunately it didn't solve the problem of getting into my configs directory.

  7. #7
    Linux Newbie
    Join Date
    Feb 2009
    Location
    Third ring of Pergatory
    Posts
    199
    I'm a certified idiot so bear with me here...
    We know your current user is Richard....type "whoami" and make sure your Richard (no, looking in the mirror doesn't count).
    The other thing you could do is run a "ps ag" as root and make sure their isn't a portion of the quake program running, If there is, killl it gentley (level 9) and see if you can stat the files then,
    If you are logged in as root or su over to root, can you access the files?

  8. #8
    Linux Newbie Ziplock's Avatar
    Join Date
    Jan 2009
    Location
    Adelaide
    Posts
    169
    Hi there

    Currently your problem is that directories need to executable for you to get access to them. The following should work:

    Code:
    $ chmod a+x configs
    I don't know what your initial problem with not stat'ing the file is though.

    Maybe run an fsck on the partition to see if there are any problems?

  9. #9
    Just Joined!
    Join Date
    Mar 2009
    Posts
    4
    Quote Originally Posted by Ziplock View Post
    Currently your problem is that directories need to executable for you to get access to them. The following should work:

    Code:
    $ chmod a+x configs
    Thanks a lot, that solved the problem. I suppose the problem was quite obvious if I'd open my eyes and look but it's funny how you don't notice obvious things when you're not really sure what you're doing. I was also distracted by the green background the configs directory had acquired. It still has a green background and I'm not sure why.

    Thanks again for the help.

  10. #10
    Linux Newbie Ziplock's Avatar
    Join Date
    Jan 2009
    Location
    Adelaide
    Posts
    169
    The green background was what gave it away for me That's the thing with Linux - you only learn by getting your hands dirty, so keep up the good work.

    As an aside, I think you may have set another permission bit at some stage. I don't know what caused it, but the following will get you back to basic permissions (i.e. get rid of the green background) for sure:

    Code:
    chmod 0777 configs
    NOTE: This is readable and writable by everyone, but I based it on your first post. The '0' is the important one anyway.

    Glad I could help at any rate!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...