srdusr
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2023-06-03 23:58:05 +0200
committersrdusr <[email protected]>2023-06-03 23:58:05 +0200
commit4a9deeaa9c36338586327e17c3d8687c03a3e716 (patch)
treea6e622c626db8bc36433f45f7428c49efea04335
parenta2c6a0e0a9ae42b3f84975858345e208667fb26e (diff)
downloadnotes-4a9deeaa9c36338586327e17c3d8687c03a3e716.tar.gz
notes-4a9deeaa9c36338586327e17c3d8687c03a3e716.zip
Reorganizing and completing guide/info about ssh
-rw-r--r--tools/ssh.md36
1 files changed, 34 insertions, 2 deletions
diff --git a/tools/ssh.md b/tools/ssh.md
index 9947617..b005a08 100644
--- a/tools/ssh.md
+++ b/tools/ssh.md
@@ -76,8 +76,6 @@
* Start server in machine that will ssh into
`$ sshd`
-* Send authorization to the remote target so we can ssh into the machine
-`$ ssh-copy-id -p 8022 -i ~/.ssh/id_rsa.pub [email protected]`
* Android remote host into desktop server, assuming default port 8022
`$ ssh [email protected] -p 8022`
@@ -120,3 +118,37 @@ How to SSH File Transfer from Remote to Local
3. Move 'r' using scp from remote to local on local using a single file.
`$ scp -r -P 22 remoteserver:/remote/folder/remotefile ~/localdir/localfile`
+
+- - -
+
+- (Optional) Install openssh
+`$ apt install openssh`
+
+- Make sure `passwd` is set for the server (root/non-root user)
+
+- On server machine edit sshd_config
+`$ vi /etc/ssh/sshd_config`
+
+- Find and change the line `#Port 22` to `Port 8022`
+- Find the line `#PermitRootLogin prohibit-password` or `#PermitRootLogin yes` and change it to `PermitRootLogin yes`. If it is already `PermitRootLogin yes` then don't change anything.
+- Now do `ssh-keygen -A` and then `ssh-keygen`
+ or
+ `$ ssh-keygen -b 4096 -t rsa`
+
+- OpenSSH has a utility to send the key remotely via either machine
+`$ ssh-copy-id -p 8022 -i ~/.ssh/id_rsa.pub [email protected]`
+
+- Ssh into the host server machine from the local machine
+`$ ssh [email protected] -p 8022`
+
+
+- - -
+
+#### Trouble-shooting
+- Check or disable firewall
+`$ sudo ufw status`
+`$ sudo ufw disable`
+`$ sudo ufw reload`
+`$ sudo ufw allow port/tcp` # if default port 22
+`$ sudo ufw allow 8022/tcp` # if using specific port
+