LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-06-2017, 07:58 AM   #1
sdowney717
Member
 
Registered: Sep 2015
Posts: 447

Rep: Reputation: Disabled
bad info on websites that does not work


From here wading thru the ways to do things, the only one that worked for me is
sudo chown -R $USER:$USER /path/to/dir

https://askubuntu.com/questions/6723...-and-ownership

While others were saying do this

sudo chown -R username:group directory

Anyway good luck trying to figure it out on your own, which many times you must. No explanation of what 'group directory' actually means.
 
Old 07-06-2017, 08:14 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,814
Blog Entries: 15

Rep: Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661
Uh...

It's just 2 different ways of saying the same thing. Presumably the posters think you know basic UNIX/Linux commands such as chown and are only telling you that you need to chown.

You can type "man chown" to learn about this command.

In both usages you list they are showing standard information:
chown = The command to change owner (and/or group) of a file or directory.
user = The user you want to be the owner of the file or directory.
:group = The group you want put on the file or directory. The colon here is to show the user is on left and group on right.
file = The file on which you are changing the owner and/or group

In Linux a directory is a special type of "file". If you run "-R" with chown it says to do it recursively (i.e. not just the directory but all the other files in the directory including any subdirectories and files.

The first usage is suggesting $USER for both "user" and "group". This implies you've set a variable called USER before that usage. It also assumes you have both a "user" and a "group" with the same name (or number [uid for user and gid for group]). They specify "/path/to/dir" to tell you that you need to figure out the full path of the directory (e.g. /var/www/billybob).

In the second usage you're being told exactly the same thing. It is suggesting "username" for user and "group" for group and "directory" for directory.

If you need help it is OK to ask for it but you don't have to imply others that have previously posted help somehow did YOU wrong because YOU don't understand.

Last edited by MensaWater; 07-06-2017 at 08:52 AM.
 
Old 07-06-2017, 08:16 AM   #3
erik2282
Member
 
Registered: May 2011
Location: TX
Distribution: Debian
Posts: 762

Rep: Reputation: 220Reputation: 220Reputation: 220
'group' is the group you want the file or directory to belong to. 'directory' is the folder that you want to change permissions on
 
Old 07-06-2017, 10:55 AM   #4
sdowney717
Member
 
Registered: Sep 2015
Posts: 447

Original Poster
Rep: Reputation: Disabled
using it this way, what syntax to change from root ownership to user a folder and all subfolders and files?

'sudo chown -R username:group directory', likely does not work that way.

I had to cut and paste from an old user account many files and pictures into my user account, and could only do it graphically by using 'sudo nemo', which then left all the copies owned by root.

then this worked great here, as mentioned in another response on that page 'sudo chown -R $USER:$USER /path/to/dir'
The other answers did not seem to fit the question.

Last edited by sdowney717; 07-06-2017 at 10:57 AM.
 
Old 07-06-2017, 10:58 AM   #5
erik2282
Member
 
Registered: May 2011
Location: TX
Distribution: Debian
Posts: 762

Rep: Reputation: 220Reputation: 220Reputation: 220
Quote:
Originally Posted by sdowney717 View Post
using it this way, what syntax to change from root ownership to user a folder and all subfolders and files?

'sudo chown -R username:group directory', likely does not work that way.
You already have the syntax. See above command. Yes it does work that way. It's possible that I'm not understanding what you're trying to say, though..

as an example:

Lets say the root user copied the Monthly_Reports directory into user benjamin's Documents directory and was still owned by root. To change it so that its owned by benjamin and the Users group do the following

Code:
# chown -R benjamin:Users /home/benjamin/Documents/Monthly_Reports
The -R switch means recursive, meaning it will make the Monthly_Reports directory, and anything under it, belong to user benjamin and belong to group Users. In my example there is a hash tag before the command meaning I am operating as root, but I'm sure this can be done with sudo as well. Pretty basic. See man pages for more info.

Last edited by erik2282; 07-06-2017 at 11:09 AM.
 
Old 07-06-2017, 10:59 AM   #6
sdowney717
Member
 
Registered: Sep 2015
Posts: 447

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by erik2282 View Post
You already have the syntax. See above command. Yes it does work that way.
Ok, it works for you, but see I dont know what to type in for 'usergroup', dont have a clue.
 
Old 07-06-2017, 11:14 AM   #7
erik2282
Member
 
Registered: May 2011
Location: TX
Distribution: Debian
Posts: 762

Rep: Reputation: 220Reputation: 220Reputation: 220
You can see your groups like this:
Code:
erik@mycomputer:~$ id
uid=2007(erik) gid=502(Users) groups=502(Users),25(floppy),27(sudo),30(dip),116(mlocate)
See where it says "gid=502(Users)"? Thats what you want to use for group in that command, Users. Yours may be different. So run the id command and post the output here in quotes.

Just read MensaWaters' post. He already explained what I said.. Sorry for adding redundant info...

Last edited by erik2282; 07-06-2017 at 11:17 AM.
 
Old 07-06-2017, 11:26 AM   #8
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,799

Rep: Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279
Quote:
Originally Posted by sdowney717 View Post
Anyway good luck trying to figure it out on your own, which many times you must.
Yup. That's pretty much *nix in a nutshell. Fortunately there are sites like LQ and askubuntu.com where you can get help.

I came from the mainframe world, originally, Burroughs MCP OS; COBOL; LINC -- creating applications specific to the needs of my employer or customer (I actually wrote a General Ledger system once!).
When I transitioned to Unix, the biggest challenge I faced was that I didn't know what I didn't know. That's generally true anytime we need or want to learn something new, but *nix can be particularly daunting for the newbie.

First I learned about man pages. man chown will tell you everything you need to know about changing ownership on files [once you learn that "chown" is the command you need to learn about -- once you know what you don't know ]

Then I bought a half-dozen O'Reilly books and read them. Learning even more about what I didn't know.

These days, one can get most (or maybe all) of the information that's in those books with a web search.

Be patient with yourself. You'll get there.

Last edited by scasey; 07-06-2017 at 11:29 AM.
 
Old 07-06-2017, 03:09 PM   #9
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,814
Blog Entries: 15

Rep: Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661
Quote:
Originally Posted by scasey View Post
I faced was that I didn't know what I didn't know. That's generally true anytime we need or want to learn something new, but *nix can be particularly daunting for the newbie.
As you say it is true for pretty much everything. Once upon a time I had to learn DOS. I later learned MS Windows then Novell Netware then UNIX (AT&T then SCO, then HP-UX, then SunOS, Then Solaris, then FreeBSD etc...) then Linux (Caldera then RedHat then Debian then Fedora then CoreOS etc...)

Often it is a matter of knowing concepts that are appropriate to various systems then learning methods for the same concepts on other systems. DOS introduced me to command line. Novell introduced me to users and groups. UNIX/Linux introduced me to the world.

Years ago I would connect different tables on Paradox (DB on DOS) easily but later on trying to figure out how to do the same kind of connection in Informix on UNIX I had a dickens of a time mainly because I didn't know this was called doing an "outer join". Solution was to scan through the entire Informix manual page by page until I got to one that seemed to be talking about what I wanted to do.

Life is much easier now. You have man pages built into the systems for many things and for other things there is a plethora of help on the internet. Often you can simply type a keyword followed by "tutorial" to get nice startup guides. (e.g. "bash tutorial", "web tutorial", "awk tutorial"). In fact "chown tutorial" immediately pulls up among other things:
https://www.howtoforge.com/linux-chown-command/
 
  


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
LXer: Extreme photo-bombing: Bad Imagemagick bug puts countless websites at risk of hijacking LXer Syndicated Linux News 0 05-03-2016 11:14 PM
Is linux secure from bad websites robert.coder Linux - Newbie 13 02-29-2016 03:19 AM
how to retrieve info from a bad disk? abd_bela Debian 6 04-25-2012 03:07 AM
Bad DMA info in identify block chiendarret Linux - Hardware 2 04-02-2010 10:30 AM
LXer: How Bad Guys Hack Into Websites Using SQL Injection LXer Syndicated Linux News 0 05-23-2006 07:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:08 PM.

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