This Linux training will take you one step closer to becoming a Linux administrator. The most common and important tasks that a Linux admin is responsible for, is covered in this Linux training video. Below are the topics covered in this tutorial:
1) Linux File Permissions
2) ACLs (Access Control Lists)
3) Shell Scripting
4) Patching In Linux
5) Networking In Linux:-
a) SSH For Remote Host Access
b) SFTP For Remote File Transfer
c) SCP For Remote Folder Transfer
3. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
Job Roles Of A Linux Administrator
✓ Installation & Upgradation
✓ Patching
✓ Application Support
✓ Storage Migrations
✓ Improve Stability & Performance
✓ User Administration
✓ Installing & Configuring Servers/ Services
✓ Backup & Restore
✓ Server Monitoring
✓ Troubleshooting
Network Engineer
Linux Admin
System Engineer
Support Engineer
Linux Admin
Job Roles
4. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
What Will You Learn Today?
✓ File Permissions
✓ ACLs (Access Control Lists)
✓ Shell Scripting
✓ Patching In Linux
✓ Networking In Linux:-
✓ SSH
✓ SFTP
✓ SCP
6. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
Setting File Permissions
$ l s – l
$ 1 e d u r e k a e d u r e k a 5 2 5 5 0 4 0 2 A u g 1 2 2 0 1 6
FILE/DIR
TYPE
USER
PERMISSIONS
GROUP
PERMISSIONS
Other’s
PERMISSIONS
SYMBOLIC
LINKS
Owner
Name
Group
Name
Time
Stamp
FILE
SIZE
Read – ‘r’
Write – ‘w’
Execute – ‘x’
FILE PERMISSIONS
Normal File – ‘-’
Directory – ‘d’
Character Special File – ‘c’
Binary Special File – ‘b’
Symbolic Link File – ‘l’
FILE TYPES
Owner/ User – ‘u’
Groups – ‘g’
Others – ‘o’
All – ‘a’
DENOTIONS
7. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
Setting File Permissions
Commands Explanation
chmod g+wx filename This gives the write and execute permission to group members
chmod u=rwx,o-wx filename
This gives the read, write and execute permission to owners, and
removes the write and execute ownership from other members
chown username filename Changes the owner of the specified file
chown username:groupname filename Changes both the owner and group ownership of the specified file
chgrp groupname filename Changes the group ownership of the specified file
chmod : To change the access permissions of files and directories
chown : To change the owner of files and directories
chgrp : To change the group ownership of file and directories
10. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
But, how will I give
the manager and
team lead extra file
permissions?
NOTE: ACLs can be used to extend the functionalities of files and directories
Do I have to
create another
group and assign
it to them?
Let’s try using
ACLs for special
privileges.
SOLUTION!!
11. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
Access Control List
➢ ACLs allow you to give permissions for any user or group to any directory/ file/ disc resource.
➢ We can enable ACL by defining it in /etc/fstab file.
➢ In the options listed under ‘/’, we need to add acl after defaults (Line 2 in the below snippet)
[edur ek a@localhost ~ ]$ c at / etc /fs tab
/dev/mapper / VolGr oup -lv_r oot / ext4 defaults ,ac l 1 1
U U ID = a8214a61 -8cb9 -4a2c-b 9 3 9-e1be9cd81bf8 /boot ext4 defaults 1 2
/dev/mapper / VolGr oup -lv_s w ap s w ap s w ap defaults 0 0
tmpfs /dev/ s hm tmpfs defaults 0 0
devpts /dev/pts devpts gid = 5,mode=620 0 0
s ys fs /s ys s ys fs defaults 0 0
pr oc /pr oc pr oc defaults 0 0
$ s udo mount - o r emount /
$ mount
12. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
Adding ACL For Files & Directories
➢ Syntax for adding ACL is:-
$ setfacl –m user:username:permissions filename
➢ Syntax for viewing the existing ACL rules:-
$ getfacl filename
[edur ek a@localhost D oc uments ]$ s etfac l - m u:us er 1:rw x File1.txt
[edur ek a@localhost D oc uments ]$ getfac l File1.txt
# file: File1.txt
# ow ner: edurek a
# gr oup: edur ek a
us er :: r w -
us er :us er1:r wx
gr oup:: r w -
mas k :: r w x
other ::r --
14. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
Shell Scripting
➢ A shell script (shell program) is a file containing a group of commands that need to be executed.
➢ Advantage One file containing all the commands can be executed.
➢ Note: Shell scripts are Interpreted and not Compiled.
First line of every shell script is: #! /bin/bash
[edur ek a@localhost D oc uments ]$ c at hello.s h
#! /bin/bas h
ec ho "H ello Wor ld“
[edur ek a@localhost D oc uments ]$ bas h hello.s h
H ello Wor ld
17. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
Patching Security Fixes & Software Updates
➢ When there is a security fix/ software update available, we can apply changes using a Patch file.
➢ A patch file is a text file which contains the differences between two versions of the same file (or same source-tree).
➢ A Patch file is created by using diff command.
18. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
Creating A Patch File
$ diff -u hello.c hello-new.c > hello.patch // Creates a new hello.patch file containing the differences
patch < hello.patch // Applies the patch from hello.patch
$ cc hello.c -o hello // To compile the program
$ ./hello // To run the program
Bug Fixes
20. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
SSH For Accessing Remote Machines
➢ SSH is a communication protocol used for accessing remotely located machines.
➢ Once connected, commands can be executed on the remote machine.
$ sudo chkconfig sshd on
$ sudo service sshd start // Start the SSH service
$ ssh remote-username@remote-host // Command for connecting to remote machine
SSH For Remote Host Access
21. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
SSH Commands
$ ssh master // Running this command at the slave node will give remote access to master
$ ssh slave // Running this command at the master node will give remote access to slave
$ sudo gedit /etc/hosts // Add the below IP addresses in both the master and slave’s hosts file
master 192.168.56.102
slave 192.168.56.103
$ ip addr show // To show the IP address
$ sudo ip addr del ip-address dev eth1 // Deleting existing IP
$ sudo ip addr add 192.168.56.102/24 dev eth1 // Adding IP at the master’s node
$ sudo ip addr add 192.168.56.103/24 dev eth1 // Adding IP at the slave’s node
22. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
SFTP For Transferring Files
$ sftp ip-address // Syntax for establishing SFTP connection
sftp> // Remote host’s directory
sftp> lcd // To change directory in host machine
sftp> cd // To change directory in remote machine
sftp> get filename pathname // For downloading a file
sftp> put filename pathname // For uploading a file
➢ SSH cannot be used for downloading/ uploading files from remote machine.
➢ SFTP (Secure File Transfer Protocol) is used for transferring files.
23. www.edureka.co/linux-adminEDUREKA’S LINUX ADMINISTRATION CERTIFICATION TRAINING
SCP For Transferring Folders & Directories
$ scp -r remotehost:pathname pathname // Syntax for downloading a directory
$ scp -r pathname remotehost:pathname // Syntax for uploading a directory
➢ SFTP cannot be used for transferring folders/ directories.
➢ SCP is the protocol used for downloading/ uploading folders/ directories.
➢ Note: In the syntax, source comes first and then comes destination