-
Notifications
You must be signed in to change notification settings - Fork 0
Step 7: Linux administration
monotiller edited this page May 27, 2022
·
2 revisions
- Client/server: Client sends a request, a server recieves and processes it
- Network protocol: Any established set of rules that determines how data is transmitted between different devices is considered a network protocol a. TCP IP b. HTTP c. FTP
- Algorithm: Set of rules or process which needs to be followed to solve a problem
- Packet: Data is fragmented into packet for easier transmission
- Payload: Actual data within the packet
- Remote Server: Any computer that is not physically attached to your keyboard/monitor/mouse is considered a remote server
- Stands for: Secure Shell
- Cryptographic network protocol to send encrypted packets over a network
- Meant to address issues with similar tools with regards to encoding data over a network
- The server is connected to your local keyboard/mouse/keyboard
- Safer than putting in username/password
- SSH uses asymmetric cipher for encryption and decryption of packets
- This means that there needs to be a pair of keys a public and private one
- The more complex the algorithm, the harder to decrypt the data
-
Establish connectivity between client and server
-
Send encrypted data across the channel
-
A key pair has to exist
- The public and private key
- You cannot use a publc key that belongs to another private key
- The client shares the public key with the remote server
- The server has to confirm that the client is who they say they are and not someone sitting in the middle
- Once it recieves a connection request from the client it uses the public key that it has to encrypt some random data and send it to the client to decrypt
- If the client can't decrypt it is disconnected
- Misconfiguration can prevent you from ever being able to log in to the system
- Lost private key means you are stuffed
Useful things to know
- Connection logs are stored in
/var/log/auth.log
. You can usetail -f
to follow updates to the folder
-
sudo
is used to give you super user privaleges -
su
let's you switch to another user. For example usera can switch to userb by doingsu userb
assuming they have the correct permissions -
/etc/sudoers
is a file that determines who has sudo access. You can also specify new groups with permissions in this file too just in case you want to fine tune what a user can and can't do -
groupadd
allows you to create a groupsudo groupadd devops
-
usermod
alloes you to add a user to a group:sudo usermod -a -G devops monotiller
-
id
let's you see what groups a user belongs to -
/etc/ssh/sshd_config
is a file that allows you to set some of the ssh configurations-
PermitRootLogin
allows you to specify how the root user can log in:
PermitRootLogin no PermitRootLogin without-password #Means you need the private key
-
-
sudo sshd -t
allows you to test the configuration for errors - Changes don't take place until you restart the ssh service
sudo systemctl restart sshd
- Uses SSH so you will need your key!
- To move a folder:
sftp [ip]
- You are now presented with a new command line instance.
- This is the key difference between SFTP and SCP as SCP you have to specify the destination in the command whereas SFTP allows you to interact with the host
-
put
allows you to upload a file or directory from your client to the host- Caveat being that the directory must exist on the host too if you're uploading a directory
-
get
allows you to download from the host to the client
-
scp
is a lot faster to upload a file or directoryscp -r [local directory] [user]@[ip]:[destination directory]
-
bg
let's you run a process in the background which allows you to continue using that terminal instance. Very useful for processes that will take a long time such as a backup or a file transfer- You will need to kill the process though if you want it to stop
-
nohup
allows you to bring the process forward if it's running in a separate terminal
-
fg
brings a process from the background to the foreground, will take over terminal -
jobs
shows the currently running jobs -
process
shows what processes are present on the system -
states
shows processes' current state (running, sleeping, uninteruptable, etc.) -
kill
kills a process, adding the flagl
let's you see what kind of kills you have available