LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-25-2008, 11:12 PM   #1
Tom_ZeCat
LQ Newbie
 
Registered: May 2008
Location: Omaha, Nebraska
Distribution: Ubuntu
Posts: 20

Rep: Reputation: 0
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.
 
Old 07-25-2008, 11:30 PM   #2
johnson_steve
Senior Member
 
Registered: Apr 2005
Location: BrewCity, USA (Milwaukee, WI)
Distribution: Xubuntu 9.10, Gentoo 2.6.27 (AMD64), Darwin 9.0.0 (arm)
Posts: 1,152

Rep: Reputation: 46
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/

Last edited by johnson_steve; 07-25-2008 at 11:34 PM.
 
Old 07-25-2008, 11:41 PM   #3
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
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
 
Old 07-27-2008, 10:54 AM   #4
Tom_ZeCat
LQ Newbie
 
Registered: May 2008
Location: Omaha, Nebraska
Distribution: Ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
The help here is greatly appreciated. The problem is solved.
 
Old 07-27-2008, 12:43 PM   #5
johnson_steve
Senior Member
 
Registered: Apr 2005
Location: BrewCity, USA (Milwaukee, WI)
Distribution: Xubuntu 9.10, Gentoo 2.6.27 (AMD64), Darwin 9.0.0 (arm)
Posts: 1,152

Rep: Reputation: 46
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.
 
Old 07-27-2008, 12:53 PM   #6
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
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

Last edited by Mr. C.; 07-27-2008 at 12:56 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
chown rust8y Solaris / OpenSolaris 3 11-02-2007 05:04 PM
chown strycnine Slackware 5 12-07-2006 10:39 AM
chown lsu420luv Linux - Newbie 3 04-18-2006 06:08 PM
troubles with SATA, troubles with NVIDIA aevangelica Linux - Hardware 6 10-17-2005 03:39 AM
chown? joetec Linux - Newbie 6 04-07-2002 05:46 AM


All times are GMT -5. The time now is 11:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration