Linux Classroom notes 30/July/2026

ssh

  • username and password
  • username and pravite key file ssh -i ~/Downloads/github.pem ubuntu@34.229.212.219 ssh -i <path of pemfile> username@ipaddress

create user and allow password auth

sudo adduser dev

## Edit file and add password auth yes
sudo nano /etc/ssh/sshd_config.d/50-cloudimg-settings.conf

PasswordAuthentication yes

sudo systemctl restart ssh

ssh username@ipaddress

scp -r ~/data dev@34.229.212.219:/home/dev/
dev@34.229.212.219's password: <enter password>
auth.log                                                    100%   52KB 120.8KB/s   00:00
data.txt                                                    100%   27     0.1KB/s   00:00


## output
dev@ip-172-31-41-244:~$ ls
data
  • To create pemfile
    • ssh-keygen
  • copy public file to linux machine
    • cat ~/.ssh/id_ed25519.pub | ssh -i ~/Downloads/github.pem ubuntu@34.229.212.219 "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

SCP (secure copy portocal)

  • scp source desc
    • scp -i ~/Downloads/github.pem data.txt ubuntu@34.229.212.219:/home/ubuntu/
    • scp data.txt ubuntu@34.229.212.219:/home/ubuntu/scp/
  • Donload files from remote
    • scp -i ~/Downloads/github.pem ubuntu@34.229.212.219:/var/log/auth.log .
    • scp -r -i ~/Downloads/github.pem ~/data ubuntu@34.229.212.219:/home/ubuntu/

sftp : secure file transver protocal:

sftp> ls                     # list remote directory
sftp> lls                    # list local directory
sftp> cd /path/to/dir        # change remote directory
sftp> lcd /path/to/dir       # change local directory
sftp> pwd                    # print remote working directory
sftp> lpwd                   # print local working directory
sftp> get file.txt           # download file from remote to local
sftp> get -r remote_dir      # download directory recursively
sftp> put file.txt           # upload file from local to remote
sftp> put -r local_dir       # upload directory recursively
sftp> mkdir new_dir          # create remote directory
sftp> rmdir old_dir          # remove remote directory
sftp> rm file.txt            # delete remote file
sftp> rename old.txt new.txt # rename remote file
sftp> chmod 755 file.txt     # change remote file permissions
sftp> exit                   # close the sftp session

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube