LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   chown troubles (https://www.linuxquestions.org/questions/linux-newbie-8/chown-troubles-658320/)

Tom_ZeCat 07-25-2008 10:12 PM

chown troubles
 
I'm not sure what I'm doing wrong here. My goal is to make sure I have ownership of the directory, /home/tom/.kde/share/apps/amarok.

So that I wouldn't have to type out that long path, I used cd to get to the directory: /home/tom/.kde/share/apps/

I figured the rest would be simple, but I must be doing something wrong. Here's a cut'n'paste of what I did:

Code:

tom@toms-jukebox:~/.kde/share/apps$ ls
amarok    d3lphin  juk          kcookiejar  khelpcenter  konsole  RecentDocuments  smb4k
amarokOLD  drkonqi  kconf_update  kfile      konqueror    kwallet  remoteview
tom@toms-jukebox:~/.kde/share/apps$
tom@toms-jukebox:~/.kde/share/apps$ pwd
/home/tom/.kde/share/apps
tom@toms-jukebox:~/.kde/share/apps$ sudo chown tom: amarok
sudo: unable to resolve host toms-jukebox
tom@toms-jukebox:~/.kde/share/apps$ sudo chown tom: /amarok
sudo: unable to resolve host toms-jukebox
chown: cannot access `/amarok': No such file or directory
tom@toms-jukebox:~/.kde/share/apps$ sudo chown tom: /amarok/
sudo: unable to resolve host toms-jukebox
chown: cannot access `/amarok/': No such file or directory

I wondered if maybe I needed to include the -R parameter since I want ownership of not just the directory, but also of all the files in it and of any subdirectories if they exist. I tried adding it, but still had problems:

Code:

tom@toms-jukebox:~/.kde/share/apps$ sudo chown -R tom: amarok
sudo: unable to resolve host toms-jukebox
tom@toms-jukebox:~/.kde/share/apps$ sudo chown tom: amarok -R
sudo: unable to resolve host toms-jukebox

I wondered if the problem is I may need to tell it it's a directory. Just to see if what I was doing would work on a file, I cd-ed into the amarok directory and tried chown on one of the files in it. No dice. Here's what happened:

Code:

tom@toms-jukebox:~/.kde/share/apps/amarok$ sudo chown -R tom. collection.db
sudo: unable to resolve host toms-jukebox
tom@toms-jukebox:~/.kde/share/apps/amarok$ sudo chown tom. collection.db
sudo: unable to resolve host toms-jukebox
tom@toms-jukebox:~/.kde/share/apps/amarok$ sudo chown tom. collection.db
sudo: unable to resolve host toms-jukebox
tom@toms-jukebox:~/.kde/share/apps/amarok$ sudo chown tom: collection.db
sudo: unable to resolve host toms-jukebox
tom@toms-jukebox:~/.kde/share/apps/amarok$ sudo chown tom :collection.db
sudo: unable to resolve host toms-jukebox
chown: cannot access `:collection.db': No such file or directory

As you can see, I've tried changing things up, but haven't had luck yet. I've googled chown and read over summaries on how to use it, but there must be something that I'm not quite getting. Any help on this would be greatly appreciated.

johnson_steve 07-25-2008 10:30 PM

Instead of using sudo I would:
Code:

su -
this will prompt you for your root password, then make you root. then cd to the directory and chown. when your done being root just type exit.
sometimes if sudo is not set up right it can cause weird problems so I don't use it unless I set it up for a specific thing. most likely however the problem is that colon. what gave you the Idea to put that in there? try it like this:
Code:

chown -R tom folder/
or
chown -R tom:users folder/
but not
chown -R tom: folder/


Mr. C. 07-25-2008 10:41 PM

Don't ignore problems that are staring you in the face:

Code:

sudo: unable to resolve host toms-jukebox
Add the line:

Code:

127.0.0.1  toms-jukebox
to your /etc/hosts file to eliminate the error.


Code:

sudo chown tom: amarok              # Correct, but don't need : after owner (chown tom amarok)
sudo chown tom: /amarok            # Incorrect: refers to file or dir in root dir /
sudo chown tom: /amarok/            # same as above

to chown files under amarok, add -R option to chown:

Code:

sudo chown -R tom amarok

Tom_ZeCat 07-27-2008 09:54 AM

The help here is greatly appreciated. The problem is solved.

johnson_steve 07-27-2008 11:43 AM

Mr. C,
I'm just curious; why would chown try to look up the hostname? as far as I know it has nothing to do with the network at all. I never set hostnames on my network I always just use static IP addresses. all hosts are called localhost and I've never encountered such an error unless I try to substitute a hostname for an IP like with ping.

Mr. C. 07-27-2008 11:53 AM

Chown doesn't, sudo does. Sudo can be configured to allow privilege elevation for only certain clients (or users, or groups, ...).

Therefore, it looks up your hostname and IP.

The first clue to any command's errors when launched by the shell is the first part:

Code:

sudo: unable to resolve host toms-jukebox


All times are GMT -5. The time now is 04:00 AM.