Rakesh Jain Profile picture
Jul 25 β€’ 27 tweets β€’ 3 min read Twitter logo Read on Twitter
Mastering SSHπŸ”’!

A Thread explaining 15 most crucial SSH commands πŸ‘‡ Image
What is SSH!πŸš€

SSH (Secure Shell) is a secure network protocol that enables users to access & manage remote machines securely over an encrypted connection. It provides a safe & encrypted way to execute commands, transfer files, & perform various tasks on remote servers. #SSH
1/ πŸ”‘To connect to a remote machine, use:

ssh username@remote_host

Replace "username" with your account & "remote_host" with the server's IP/hostname. #SecureConnections #RemoteAccess
2/πŸ—οΈ Did you know? You can use SSH keys for authentication, avoiding passwords. Generate your key pair with:

ssh-keygen -t rsa

Then copy your public key to the remote server's ~/.ssh/authorized_keys file.

#KeyAuthentication #SecurityMatters
3/🌐 To execute commands on the remote server, simply:

ssh username@remote_host command

It'll run "command" on the server & show the output locally. Handy, right?

#RemoteCommands #SysAdminLife
4/ πŸ“ Copying files between local & remote machines? Rely on SCP (SSH Copy):

scp /path/to/local_file username@remote_host:/path/to/destination

Securely transfer files without fuss!

#FileTransfer #SSH
5/πŸ”„ Need to forward ports for secure access to services? Use SSH port forwarding:

ssh -L local_port:destination_host:remote_port username@jump_host

Now access destination_host:remote_port via localhost:local_port.

#PortForwarding #NetworkingTricks
6/⏲️ Running a long task? Prevent disconnection by keeping SSH session alive:

ssh -o ServerAliveInterval=60 username@remote_host

SSH will send a "keep-alive" signal every 60 seconds. No more annoying timeouts!

#StayConnected #ProductivityHacks
7/πŸšͺ Change the default SSH port for added security:

sudo nano /etc/ssh/sshd_config

Modify "Port 22" to a custom port, then restart SSH service. Impenetrable! πŸ”’

#SecurityFirst #CustomPort
8/ 🚧 Enable X11 forwarding to run GUI applications remotely:

ssh -X username@remote_host

Now, when you run GUI apps, they'll display on your local machine!

#GUIoverSSH #RemoteApps
9/ πŸ—„οΈ To securely store passwords, use SSH-agent:

eval "$(ssh-agent)" ssh-add /path/to/private_key

No more entering passwords repeatedly! πŸ™Œ

#SSHAgent #PasswordSecurity
10/ πŸ”’ Disallow root login via SSH to bolster security:

sudo nano /etc/ssh/sshd_config

Set "PermitRootLogin" to "no", then reload SSH. Elevate privileges smartly!

#RootLoginDenied #SecurityTips
11/ πŸšͺ Limit user access with SSH chroot:

sudo nano /etc/ssh/sshd_config

Use "ChrootDirectory" to restrict users to their home directories. Isolate & control!

#UserIsolation #AccessControl
12/ πŸ” Search remote files like a pro with "grep" over SSH:

ssh username@remote_host "grep -r 'search_term' /path/to/directory"

Search for 'search_term' in files located at '/path/to/directory' on the remote host.

#RemoteSearch #SysAdminTricks
13/ πŸ“œ Edit files on the fly using "sed" over SSH:

ssh username@remote_host "sed -i 's/old_text/new_text/g' /path/to/file"

Replace 'old_text' with 'new_text' in the specified file. Changes applied remotely!

#SSHsed #RemoteEditing
14/ πŸ“Š Monitor resource usage with "top" remotely:

ssh username@remote_host "top"

Get real-time insights into processes, CPU, and memory usage on the remote machine.

#RemoteMonitoring #SysAdminLife
15/ πŸ”„ Synchronize local and remote directories using "rsync" over SSH:

rsync -avz -e "ssh" /path/to/local_dir username@remote_host:/path/to/destination

Efficiently transfer files between local and remote locations.

#RSync #DataSync
Time for Bonus πŸ’°πŸ˜ Image
1/ 🐞 Enable debug mode to troubleshoot SSH connection issues:

ssh -v username@remote_host

Verbose mode displays detailed connection process. Unravel the mysteries!

#SSHDebugMode #Troubleshooting
2/πŸ” Authenticate with PEM file (private key) instead of passwords:

ssh -i /path/to/key.pem username@remote_host

Boost security & login with your PEM file. No more passwords! πŸš€

#PEMfile #SecureAuthentication
3/ πŸ“ Copy files using PEM file with SCP:

scp -i /path/to/key.pem /path/to/local_file username@remote_host:/path/to/destination

Combine security & file transfer in one go! πŸ”’

#SCPPemFile #SecureCopy
4/ πŸ›‘οΈ Use PEM file with Rsync for secure synchronization:

rsync -avz -e "ssh -i /path/to/key.pem" /path/to/local_dir username@remote_host:/path/to/destination

Safeguard data while syncing directories. πŸ”

#RSyncPEM #SecureDataSync
5/πŸ¦πŸ’» SSHAliases: Create aliases for quick access to servers. Edit bash/zsh profile file.

πŸ’» alias server1='ssh user@example[dot]com'
πŸ’» alias server2='ssh user@example[dot]com'

πŸ”’ #Aliases #SSH
6/ πŸ¦πŸ’»SSHFS: Mount remote directories over SSH.
Install 'sshfs' & mount like:

πŸ’» sshfs user@example[dot]com:/remote/path /local/mount/point
7/ πŸ¦πŸ’»SSHKnownHosts: Manage known hosts to prevent man-in-the-middle attacks.

πŸ’»nano ~/.ssh/known_hosts
Go forth and master these advanced SSH commands! πŸ’ͺ Happy remote management!

#SSHAdvanced #SysAdminTools

(Note: Always exercise caution when executing commands that modify or transfer data remotely.)
Retweet the thread if you find it useful. Thanks!

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Rakesh Jain

Rakesh Jain Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @devops_tech

Jul 26
Mastering Redirection in Linux! πŸ§πŸ”€

A Thread explaining 15 most useful redirection command examples πŸ‘‡ Image
πŸ‘‰ At the heart of the Linux command-line lies the power of "Redirection." It's a technique that allows you to control where input and output streams flow. Let's explore this magical concept!

✨ #Linux #CommandLineMagic
1️⃣ Streams of Data:

In Linux, every process has three data streams: Standard Input (stdin), Standard Output (stdout), and Standard Error (stderr).

Redirection enables us to manage these streams like a pro! 🌊
Read 36 tweets
Jul 24
πŸ” Mastering OpenSSL πŸ”

A Thread with 20 most useful OpenSSL command examples to get you started! πŸš€

#OpenSSL #Security #Linux Image
What is OpenSSL?

πŸ“œ OpenSSL is a versatile open-source toolkit for SSL/TLS protocols and cryptographic functions. It secures network communications, generates certificates, and more! Here are 20 essential OpenSSL command examples to get you started! πŸš€ #OpenSSL #Security
1/πŸ”’ Generating a Private Key:

$ openssl genpkey -algorithm RSA -out private.key

Explanation: Generate a new RSA private key and save it in 'private.key'. Remember to keep your private keys secure!
Read 24 tweets
Jul 22
Mastering Name Spaces! πŸ§πŸ”

A Thread Explaining the difference between Linux Name Spaces vs. Container Name Spaces πŸ§πŸš€ Image
Understanding Linux Name Spaces πŸ§πŸ” Image
1/7: Hey All! Today, we're going to explore the fascinating world of Linux Name Spaces!

πŸŒπŸ€“ At a high level, Name Spaces are a feature in the Linux kernel that allow processes to have isolated views of system resources. Let's dive in! #Linux #Namespaces
Read 26 tweets
Jul 21
Mastering Reverse Proxy!

What is a Reverse Proxy? πŸ”„

A Thread explaining a step-by-step guide to configure Nginx as a reverse proxy πŸ‘‡ Image
What is a Reverse Proxy? πŸ”„

1/ A reverse proxy is a server that sits between clients and backend servers. Unlike a regular proxy, it handles requests on behalf of the server, not the client. Think of it as the "middleman" between users and web applications. 🌐 #ReverseProxy
2/ When a client sends a request to access a web application, it goes through the reverse proxy first. The proxy then forwards the request to the appropriate backend server that hosts the application. This allows the backend servers to remain hidden and secure. πŸ”’ #WebServer
Read 24 tweets
Jul 18
Mastering Docker Swarm!

A Twitter thread with 20 useful Docker Swarm commands πŸ‘‡ Image
#DockerSwarm Explained πŸ³πŸš€ πŸ‘‰

Docker Swarm is a native clustering and orchestration solution for Docker containers. πŸ—οΈ It allows you to manage a group of Docker hosts as a single virtual system, creating a distributed and scalable container environment.
#DockerSwarm Features πŸ’‘

πŸ”Ή High Availability: Docker Swarm ensures your applications are resilient and available even if some nodes fail.

πŸ”Ή Load Balancing: Swarm intelligently distributes incoming traffic across containers to prevent overloading.
Read 28 tweets
Jul 17
Mastering Linux User Management!πŸ‘¨β€πŸ‘¨β€πŸ‘§β€πŸ‘¦

A Thread with 25 most useful Linux user management commands with examples πŸ‘‡ Image
πŸ” 1/25: adduser - Create a new user account

Example: adduser john

Explanation: Creates a new user account named "john" on the system.

#AddUser #LinuxUserManagement
πŸ”§ 2/25: usermod - Modify user account properties

Example: usermod -aG sudo john

Explanation: Adds user "john" to the "sudo" group, granting administrative privileges.

#UserMod #LinuxUserManagement
Read 27 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(