• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Home
  • Software
    • Connect2SSH
    • Cover Your Ass(ets)
    • Protect Disks
    • Vivaldi Installer
    • WordPress Plugins
    • Plugin Suggestion
    • Telegram
  • Linux
    • The Short Explanation
    • Networking & Connect2SSH
    • Debian Package Creation
  • 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

Primary Sidebar

Resource Center
✓ BlissPlan.com - Shop | Downloads
External Resource
✓ Professional Banner Design
Professional Technical Consulting
Are you looking for professional US based technical consulting? Our lead tech, Jeremy O'Connell, has been assisting other companies for over fifteen years. His vast online and computer systems experience and knowledge allows all kinds of ventures to stay operational.
View more details ...
Software Downloads
software
BASH Utilities
Wordpress Plugins
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 25,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, LLC. All rights reserved. © 2002-2023.
Designated trademarks and brands are the property of their respective owners.