element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
sudo Sergeant
  • Challenges & Projects
  • element14 presents
  • sudo Sergeant
  • More
  • Cancel
sudo Sergeant
Documents sudo Sergeant 11: Account Management
  • Blog
  • Forum
  • Documents
  • Events
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
sudo Sergeant requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Engagement
Author: tariq.ahmad
Date Created: 7 Dec 2017 8:32 PM
Last Updated: 24 Feb 2018 3:02 AM
Views: 292
Likes: 6
Comments: 3
Related
Recommended

sudo Sergeant 11: Account Management

element14's The Ben Heck Show

Join the Ben Heck team every week for amazing hacks! Watch them build and mod community-inspired projects using electronics!

Back to The Ben Heck Show homepage

sudo Sergeant
The Learning Circuit
See All Episodes

 

 

You don't have permission to edit metadata of this video.
Edit media
x
Upload Preview

Linux is a multi-user operating system that allows more than one user to use Linux at the same time.  An important role of a system administrator is managing accounts.  Felix goes over some of the mechanisms used for account management.  He shows you how to create accounts, modify accounts, and remove accounts.

 

 

From terminal, Felix takes a look at all the accounts on his machine:

$ cat /etc/passwd

This takes him to all the accounts that are on the system. To add an account you would use:

$ sudo useradd  -m  -G  sudo -s /bin/bash username

This creates a user account named username with sudo privileges.  To login to your new account you will need to first setup a password:

$ sudo passwd username

You’ll be asked to create a new password and the system will tell you when it has been updated. To login to your new account you would switch users using:

$ su username

To get out of the directory you were just in use:

$ cd ~

You’ve now created a new account, given it a password, given it sudo privileges, created a login shell, and home directory. You can now view the new user account by using:

$ cat/etc/password

To change the directory that the user account is located in use:

$ sudo usermod  -d /home/newdirectory  -m user

This will change the directory from username to user. To change the shell from /bin/bash to /bin/zsh you would use:

$ sudo usermod   -s /bin/zsh

To change the account name you would use following command:

$ sudo usermod   -l newusername username

This changes the account name from username to newusername.   You can confirm this by typing in:

$ cat /etc/passwd

To add a system account you would use the user add instruction again:

$ sudo useradd  -r  -s  /usr/nologin  system-account

This would be useful, for instance, if you had some kind of a background daemon running that needed a user.  You would assign a system account to the group.  To delete this account when you no longer need it, you would use the following command:

$ sudo userdel  -r system-account

  • multiuseroperatingsystem
  • putty
  • system administration
  • open source
  • command line
  • sudo
  • sudosergeant
  • linux
  • Share
  • History
  • More
  • Cancel
Anonymous

Top Comments

  • DAB
    DAB over 4 years ago +2

    Nice episode Felix.

     

    Thanks for reminding me why I don't use Linux.

     

    DAB

  • Workshopshed
    Workshopshed over 4 years ago +2

    Great episode although perhaps a bit mean to give your aunt an account called potatohead.

  • the48sicks
    the48sicks over 4 years ago

    Another good episode Felix.

    Could you do a feature on iptables?  A lot of new folk to Linux follow a lot of how-to's on the internet only to find that they cant connect remotely to the project they have setup because of Firewall rules, or even go into network sharing and NATing / Routing,  port forwarding and such.

     

    Another idea would be setting up projects to run with inetd. with start / stop commands and auto start on system boots.

     

    Keep up the good work!

     

    486

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • Workshopshed
    Workshopshed over 4 years ago

    Great episode although perhaps a bit mean to give your aunt an account called potatohead.

    • Cancel
    • Up +2 Down
    • Reply
    • More
    • Cancel
  • DAB
    DAB over 4 years ago

    Nice episode Felix.

     

    Thanks for reminding me why I don't use Linux.

     

    DAB

    • Cancel
    • Up +2 Down
    • Reply
    • More
    • Cancel
Element14

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2022 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube