LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   chown -R $USER /usr/src/redhat (https://www.linuxquestions.org/questions/linux-newbie-8/chown-r-%24user-usr-src-redhat-42057/)

illtbagu 01-19-2003 04:46 PM

chown -R $USER /usr/src/redhat
 
changed ownership this dir to user by running # chown -R $USER /usr/src/redhat as required for installing microsoft fonts. how can i change it back its original settings. i tried chown -R $root /usr/src/red hat but that didn't work. does anyone have any good links that explain what this command and related commands do.

thanks,
AD;)

Proud 01-19-2003 04:50 PM

Erm, ever tried man chown or reading the LQ Glossary of related terms like chmod? :)

MasterC 01-19-2003 05:07 PM

When you say it didn't work, what exactly do you mean? Also, you probably don't need to change it back, but if you want to:
chown -R root:root /usr/src/redhat

Or you can also check out other options of what to change it to. Again though, I really wouldn't worry too much about it.

Cool

illtbagu 01-19-2003 05:25 PM

http://corefonts.sourceforge.net/ is where i got the command from but if you dont think i need to change it back to what it was ill leave it the way it is. i thought though for security reasons that it might be a good idea to have only root access to this dir.

[root@dhcp-346-5 joe]# chown -R $root /usr/src/redhat
chown: too few arguments
Try `chown --help' for more information.
[root@dhcp-346-5 joe]#


thanks,
AD

MasterC 01-19-2003 05:38 PM

That's not really a directory I'd worry too much about, however if you are concerned, go right ahead, no biggie, just use the command from above:
chown -R root:root /usr/src/redhat

The $USER just meant to use the user you were currently running as, now to switch it back you'll need to use an actual name, or uid, which will work with root:root

Cool

sorryouttolunch 01-21-2003 04:13 AM

Hmm, that was a helpful reply there from 'proud'. Why waste so many characters when all you meant was RTFM? I'm new round here, so sorry if saying that's against site ettiquette.

illtbagu - the reason your command says 'too few arguments' is because the arg you are passing - $root is a bash parameter (like a shell variable). What you actually want to give is root, the name of the root user, or simply 0 - no dollarsign! $ is a special char in bash which means 'the word succeding me is a variable/parameter name'. By default these variables/parameters are empty so your command is getting expanded to:

# chown -R /usr/src/redhat

which is a bad because you must supply a username to chown.

What you meant was probably:

# chown -R root /usr/src/redhat

the stuff masterc mentions about using root:root that will also set the group to root. It's a more complete way of doing it.


Bryn
For more info on shell vars and params, do a man bash.

MasterC 01-21-2003 09:57 AM

Nice explaination. Yeah, sometimes a "check out the man page on chown" is a perfectly fine answer, other times, such as this, I doubt the manpage would help. They form in which they posed chown wasn't wrong, just the person to whom they were trying give ownership was. I don't think the man page would really cover that.

Thanks for the further explaination sorryouttolunch. :)

sorryouttolunch 01-21-2003 11:18 AM

Cheers! Yeah, what I was trying to get at was that the guy's problem was with bash expansions not chmod... in that respect I thought 'do a man chown' was a bit mean ;-)

Your reply was totally right in what it said. Infact, i woulda forgot to say root:root so it woulda been better than one from me on its own... i really must stop being lazy about group ownerships *sigh*

byeee4now

Proud 01-21-2003 01:36 PM

Sorry guys...but at least he knows of man pages and the LQ Glossary now ;)


All times are GMT -5. The time now is 09:20 AM.