SESSION2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

K a b u l Po l y t e c h n i c U n i v e r s i t y

Linux Server Administration

Lecturer: Zabehullah Nasiri


penetrationlab@gmail.com
Linux User Accounts

• useradd Create an account.


• userdel Delete an account.
• usermod Modify an account.
• passwd Change a password.
• chfn Change a user’s personal information.

2
Creating a user

• useradd [options] username


• The useradd command lets the superuser create a user account:
• → sudo useradd smith

3
Deleting a User

• userdel
• userdel [-r] username
• The userdel command deletes an existing user.
• → sudo userdel smith

4
Modifying a User

• usermod
• usermod [options] username
• The usermod command modifies the given user’s account
in
• various ways, such as changing a home directory:
• → sudo usermod -d /home/another smith
• → sudo usermod -aG sudo smith

5
Changing User’s Password

• passwd
• passwd [options] [username]
• The passwd command changes a login password,
yours by
• default:
• → passwd
• or another user’s password if run by the superuser:
• → sudo passwd smith

6
Changing User’s Information
• chfn
• chfn [options] [username]
• The chfn (change finger) command updates a few pieces ofpersonal information
maintained by the system: real name,home telephone, office telephone, and office
location, as displayedby the finger command. Invoked without a username, chfn
affects your account; invoked with a username (by root), it affects that user. With
no options, chfn will prompt you for the desired information:
• → chfn
• Password: ********
• Name [Shawn Smith]: Shawn E. Smith
• Office [100 Barton Hall]:
• Office Phone [212-555-1212]: 212-555-1234
• Home Phone []:

7
Creating and modifying Group

• Creating a group
• sudo addgroup guest

• Adding group members


• sudo adduser john guest
• sudo usermod -a -G <group1>,<group2>,<group3>
<username>

• Deleting a group
• Sudo groupdel <groupname>
8
Static IP addressing

• You can change the IP address of Ubuntu machine using following


command:
• Sudo ifconfig ens33 <ipaddress> netmask <subnetmask>
• But this changes will be temporary.

• To change the IP address of Ubuntu we need to change the


configuration file that is located at /etc/netplan/01*.yaml

9
Static IP addressing

• After the configuration is done, executed this command:


• Sudo netplan apply
10
Remotely Controlling UBUNTU

• SSH (Secure Shell) is a tool for secure system administration, file transfers,
and other communication across the Internet or other untrusted network. It
encrypts identities, passwords, and transmitted data so that they cannot be
eavesdropped and stolen.

• OpenSSH is an open-source implementation of the SSH protocol. It is based on


the free version by Tatu Ylonen and further developed by the OpenBSD team
and the user community.

11
Installing OPENSSH

• Server:
• sudo apt install openssh-server

• Client:
• sudo apt install openssh-client

• Enable SSH in Firewall:


• sudo ufw allow ssh

12
SSH Client on Windows and WINSCP

• PuTTY is an SSH and telnet client, developed originally by


Simon Tatham for the Windows platform. PuTTY is open
source software that is available with source code and is
developed and supported by a group of volunteers.

• In order to transfer file from UBUNTU to windows or vice


versa we can use winscp.

13
K a b u l Po l y t e c h n i c U n i v e r s i t y

Thank You!
Questions?

@Zabehullah Nasiri

You might also like