LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   adding users and groups (https://www.linuxquestions.org/questions/linux-newbie-8/adding-users-and-groups-4175452585/)

TechJay 03-03-2013 11:46 PM

adding users and groups
 
Hello all, i am a complete newb to linux but thought i should learn a little bit.. Im practicing an assignment from a book i have... Anyway, I can add new groups and a users to groups... How do i capture a users last name in the string ? ex.

useradd -G Managers Jon Smith

i tried "Jon Smith" ?

Thanks very much

evo2 03-03-2013 11:52 PM

Hi,

usernames can't have spaces in them. Also instead of using useradd you should probably be using adduser. What distro are you using?

HTH,

Evo2.

TechJay 03-04-2013 12:16 AM

Thanks for the quick response. hmm everything ive looked at has said useradd... im open to anything though.. Im using Fedora 13 goddard i believe..

So there is no way to add the space in my username ? or is there a global acceptance of a symbol such as _ - or something ? Im a computer science major i program in java and perl. I took intro to linux as an elective just because i thought i should know a little something. Im reviewing a case study for practice on my midterm .. Ive been going step by step and trying each ive made it to the adduser or useradd part.

1. You will need to install Linux on the computer you have been assigned
 Install Via NFS. Installation source files are available on the NFS server. Ask your instructor for the following parameters:
 NFS Server Name/IP: ___________________
 NFS Server folder: _____________________
 Use the following parameters:
 Install the boot loader to the Master Boot Record, and do not set a boot loader password
 Configure partitions as follows:
• /boot should be a 500 MB primary partition on the first SCSI hard drive
• Swap space should be approximately 768 MB on the first SCSI hard drive
• / should take up the remaining space on the first SCSI hard drive
• /home should use all of the second SCSI hard drive
 Configure networking to use DHCP. Set a host name of your first and last name, with no spaces
 Disable the firewall
 Select the following packages:
• X Window System
• Gnome Desktop
• KDE Desktop
• Editors
• Graphical Internet
• Text Internet
• Server configuration tools
• Development Tools
• Kernel Development
• Administration Tools
• System Tools
• Printing Support
2. Once the system is installed, configure the following:
 Change the default timeout in GRUB to five seconds
 As the root user, create a cron job in the root user’s cron table (not the system table) that will run at 2:10 AM every day and run the command
yum –y update
 Install the switchdesk utility with yum.
 Configure user disk quotas on the /home partition so that each user can have a maximum of 100 files and 100 MB of data.
3. There are six divisions within Innitech, with a number of employees working in each division.
 You will need to create a group for each division
 You will need to create user accounts and assign passwords for each of the employees
 Use a naming convention of firstnamelastname for each user
 Set the initial password for all accounts to penguin
 You will need to assign the employees to the appropriate group on the server
 Divisions and Employees are as follows:
• Managers
• Bill Lumbergh
• Dom Portwood
• Peter Gibbons
 Change Peter’s default desktop to KDE using switchdesk
• Marketing
• Milton Waddams
 Lock Milton’s account
• Sales
• Tom Smykowski
• Steve Magazine
• Software
• Michael Bolton
• Samir Nagheenanajar
• IT
• Your account
• Your instructor’s account
• Human Resources
• Bob Slydell
• Bob Porter
4. On the server, you will need to create a common folder for each of the users and groups to manage their work and data:
 Create a common folder called /data
 Under this, create a folder for each group, using the group’s name
 Set the appropriate standard and special file system permissions so that anything created or placed in the folders will be owned by the group, and users cannot delete other peoples work, only their own
 Add the appropriate folders to each user’s PATH variable when they log in
 Set each user’s prompt in the Software group to display the username, and the current directory each time they log in
 Install a printer. Ask your instructor for the following information:
• Make/Model: _______________
• Printer Name/IP: ____________
5. Create a scheduled task in the root user’s cron table (not the system cron table) that will dump the day’s system log files from /var/log/secure and /var/log/messages to a common file called logs for managers under the managers shared folder. The logs file should be overwritten each day.
6. Using tar and gzip, create a compressed backup of the /home folder and all of its contents, and save it to the IT group’s common folder. Next, using the mkisofs command, create an ISO image of the /data folder, called databackup.iso, and store it in the root user’s home directory.

i skipped the disk quotas until ive added the user... Im sure after i get through this ill have a few more questions about permissions and the gzip backup.. Thanks ... sorry for the long post just thought it would help for you to see what i was working with.

evo2 03-04-2013 12:35 AM

Hi,

technically the name you pass to adduser (and to useradd) is actually the users "login name". This should be lowercase possibly with numbers. Typically it will be just the given or family name of the user, or perhaps their initials. So the user John Smith might have the login "jon", "smith", "jsmith", etc. Each user on the system can also have a real name. See the /etc/passwd man page.
Code:

man 5 passwd
If you use adduser instead of useadd you will be prompted to enter various information including the users actual name.

Fedora 13 is pretty ancient and AFAIK unmaintained, but I it should have adduser.

Evo2.

evo2 03-04-2013 12:39 AM

Hi,

Quote:

Originally Posted by TechJay (Post 4904074)
 Use a naming convention of firstnamelastname for each user

Ahh, it seems you are supposed to use jonsmith as the login for Jon Smith.

Evo2.

TechJay 03-04-2013 12:44 AM

Thanks a lot.. Ill visit the man page u mentioned.. I dont know much about diff distros.. I tried the adduser -G Managers Bill ad it worked but never prompted me for more information such as real name.. also would you recomend skipping the disk quota part ? can i set it to a "default" for new users before they are created ??

chrism01 03-04-2013 01:02 AM

1. set user's quotas after creating users. You can use a prototype user, then tell system to copy that setting for each user eg
Code:

# implement a policy for user1
edquota user1

# make user2 settings same as user1
edquota -p user1 user2

This is a good Linux tutorial
http://rute.2038bug.com/index.html.gz

This is a RHEL Admin manual, should be mostly same cmds for you
http://www.linuxtopia.org/online_boo...ion/index.html

Searchable HTML version of man pages
http://linux.die.net/man/

evo2 03-04-2013 01:04 AM

Hi,

Quote:

Originally Posted by TechJay (Post 4904094)
Thanks a lot.. Ill visit the man page u mentioned.. I dont know much about diff distros.. I tried the adduser -G Managers Bill ad it worked but never prompted me for more information such as real name..

I just did a quick google and it looks like on F16 adduser is exactly the same as useradd :-(

Note that with the command you ran above the login of that user will be "Bill", but from the instructions you posted it should be billlumbergh.

You can adjust the properites of a user (including their login name) using usermod or by editing /etc/passwd (probably should use vipw for that). You can also change (or set) the users password with the passwd command.
Code:

man 1 passwd
man 8 usermod

Quote:

also would you recomend skipping the disk quota part ? can i set it to a "default" for new users before they are created ??
Sorry I'm not familiar with setting up dist quotas on Fedora.

Evo2.

TechJay 03-04-2013 01:05 AM

Thats awesome.. glad i posted some stuff now... very efficient thank u


All times are GMT -5. The time now is 03:10 AM.