• Skip to primary navigation
  • Skip to main content
  • Software
    • Connect2SSH
    • Cover Your Ass(ets)
    • Protect Disks
    • Vivaldi Installer
    • WordPress Plugins
    • Plugin Suggestion
  • Linux
    • The Short Explanation
    • Networking & Connect2SSH
    • Debian Package Creation
  • Tips
    • Gmail – Unlimited Addresses
    • Telegram
  • Policies
    • Privacy
    • Disclaimer
    • Terms Of Service
    • Terms Of Sale
    • Earnings
    • IT Consulting
    • Vulnerability Reporting
  • Contact Us

Mr. Desktop & Mr. Server Episode 5 | Linux Networking & Connect2SSH

* Class notes *

========================================
SSH
========================================

* Install SSH Server, will be activated
* Port 22, so watch firewalls
> sudo apt-get install openssh-server

* May be necessary – not on Ubuntu
> sudo systemctl enable sshd
> sudo systemctl start sshd

* Connect; if new host will ask to accept connection
> ssh USERNAME@HOSTNAME
or
> ssh -i full_path_to_key USERNAME@HOSTNAME

* How to clean known_hosts
vi ~/.ssh/known_hosts
cp /dev/null ~/.ssh/known_hosts

* Create keys:
> ssh-keygen -t rsa -b 4096 -C “My machine” -f my_machine_key
> ssh-keygen -t ecdsa -b 521 -C “My machine” -f my_machine_key

Install key:
> ssh-copy-id user@hostname
or
> ssh-copy-id -i /home/developer/.ssh/my_machine_key.pub user@hostname

* Manual copying:
chmod 700 ~/.ssh/
chmod 600 ~/.ssh/authorized_keys
~/.ssh/authorized_keys

* Auto include key:
~/.ssh/config
Host SERVER1
# IdentitiesOnly yes
IdentityFile ~/.ssh/id_rsa_SERVER1

* Save keys
– Keys will auto load if in ~/.ssh/
– However using config file one can have them auto load using ~/.ssh/config

# Update passphrase
> ssh-keygen -f my_machine_key -p

========================================
scp and rsync
========================================

Note: If key file is setup no password is necessary unless you have a password protected key

* scp – file
> scp source_file user@hostname:~/path_to_destination/

* scp – directory
> scp -R source_dir user@hostname:~/path_to_destination/
> touch file{1..20}

* rsync – files or directory
> rsync -az –delete source user@hostname:~/path_to_destination/
– Add for key: “ssh -i /home/test/pkey_new.pem”
– To test add -n so -azn

** Delete is dangerous put often necessary!!!!

========================================
sshfs
========================================

> sudo apt-get install sshfs

* Connect
> sshfs user@hostname:/full_path_to_host_dir_to_mount/ /local_mount_point
> sshfs -o IdentityFile=/home/developer/.ssh/my_machine_key developerstore@10.0.0.245:/home/developerstore/ /home/developer/mnt/centosdev/
> sshfs developerstore@10.0.0.245:/home/developerstore/ /home/developer/mnt/centosdev/

* Disconnect
> fusermount -u /local_mount_point

* Keep alive
> sudo vi /etc/ssh/ssh_config

Modify or add, then save and close
ServerAliveInterval 120

> sudo systemctl restart ssh

FSTAB:
USERNAME@HOSTNAME_OR_IP:/REMOTE/DIRECTORY /LOCAL/MOUNTPOINT fuse.sshfs noauto,x-systemd.automount,_netdev,user,idmap=user,follow_symlinks,identityfile=/home/USERNAME/.ssh/id_rsa,allow_other,default_permissions,uid=USER_ID_N,gid=USER_GID_N 0 0

Startup + BASH
Use a start up command or BASH script

https://wiki.archlinux.org/index.php/SSHFS

Notes:
– Hard? A little at first but way easier than samba!

========================================
arp-scan
========================================

Install:
> sudo apt-get install arp-scan

Usage:
> sudo arp-scan -l
* -l is local network

========================================
connect2ssh
========================================

connect2ssh config-update key_path
* No trailing slash

Cyber Criminals Want Your Information: Stop Them Cold! - FREE online video audio course, on uDemy platform,
taught by Jeremy O'Connell covering password safety/security!
* Join the over 28,000 students worldwide that have strengthen their password skills!
Polices: Privacy | Disclaimer | Terms Of Service | Terms Of Sale | Earnings | IT Consulting

CyberWS.com is a brand owned, operated and copyrighted by Cyberweb Solutions. All rights reserved. © 2002-2025.
Designated trademarks and brands are the property of their respective owners.