LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bad info on websites that does not work (https://www.linuxquestions.org/questions/linux-newbie-8/bad-info-on-websites-that-does-not-work-4175609299/)

sdowney717 07-06-2017 07:58 AM

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.

MensaWater 07-06-2017 08:14 AM

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. :tisk:

erik2282 07-06-2017 08:16 AM

'group' is the group you want the file or directory to belong to. 'directory' is the folder that you want to change permissions on

sdowney717 07-06-2017 10:55 AM

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.

erik2282 07-06-2017 10:58 AM

Quote:

Originally Posted by sdowney717 (Post 5731455)
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.

sdowney717 07-06-2017 10:59 AM

Quote:

Originally Posted by erik2282 (Post 5731457)
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.

erik2282 07-06-2017 11:14 AM

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...

scasey 07-06-2017 11:26 AM

Quote:

Originally Posted by sdowney717 (Post 5731383)
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.

MensaWater 07-06-2017 03:09 PM

Quote:

Originally Posted by scasey (Post 5731470)
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/


All times are GMT -5. The time now is 12:15 AM.