-1

I've been doing some research on how to add a user to the system so as to have a new ftp user and one of the examples I ran across was this:

useradd -m -G users,ftp,wheel joe -s /bin/bash
passwd joe
chown -R joe /var/www/

I'm new to Linux and I don't understand what is being done here after each of the initial commands (useradd, chown). Can someone please enlighten me or provide a resource where I can learn - I'm having trouble finding anything useful when I search "linux minus sign commands".

Sidenote: In my search for answers, I typed tried to find a manual on these minus commands by trying man -d. Did I break something?

Nick
  • 315
  • 2
  • 7
  • 15

2 Answers2

1

For starters, from your command line type man COMMAND so man useradd etc.

That will display the manual for each command.

There are ways more simple than your example above such as:

useradd -m tommy creates the user tommy and a group tommy as well.

Then:

usermod -a G users,wheel,ftp tommy adds the user tommy to the groups "users, wheel, and ftp"

passwd tommy allows you to change the password for the user account tommy

chown -R tommy /var/www recursively changes ownership of the /var/www directory to make tommy the owner. Though becareful because normally the apache user should have ownership of the /var/www directory.

Eli
  • 372
  • 2
  • 8
  • Sorry if this is a stupid question, but what do you mean when you say recursively changes ownership? My research would lead me to believe that it means it changes ownership for everything within that directory whereas a non-recursive change would only apply to /var/www but not child files/directories. Does that sound right? – Nick Mar 31 '11 at 04:46
  • Yes that would be correct. – Eli Mar 31 '11 at 04:52
0

I think Eli's said nearly all that needs to be said, but since your question indicates some confusion, I thought I'd be explicit about one thing:

The arguments that follow each initial command, each appearing after a - sign, are known as switches or flags, and they modify the behaviour of the initial command. There is little that is generally-valid about flags, though -v for "be verbose in your actions" is fairly universal, and very often the - is doubled if the flag's argument is more than a single letter (eg, -v and --verbose are often interchangeable).

The flags don't have much meaning in isolation from the command they modify, so hopefully it's clearer why you couldn't find information when googling on them by themselves. And finally, the man page for the man command says that the -d flag makes man print debugging information, so no, you didn't break anything.

MadHatter
  • 78,442
  • 20
  • 178
  • 229