| Next revision | Previous revision |
| linux:ssh_scp [2020/11/20 00:27] – external edit 127.0.0.1 | linux:ssh_scp [2024/11/29 17:47] (current) – [Script um Public-Key Hinzuzufügen] gsys |
|---|
| |
| ===== SSH ===== | ===== SSH ===== |
| ^ Befehl {{:dwh.gif?300x1|dwh}} ^ Funktion {{:dwh.gif?300x1|dwh}} ^ | ^ Befehl ^ Funktion ^ |
| | ssh root@[xxx.xxx.xxx.xxx] | anmelden als root bei xxx.xxx.xxx.xxx | | | ssh root@[xxx.xxx.xxx.xxx] | anmelden als root bei xxx.xxx.xxx.xxx | |
| | ssh-keygen | | | | ssh-keygen | | |
| ===== SCP ===== | ===== SCP ===== |
| | scp authorized_keys root@xxx.xxx.xxx.xxx: | schickt authorized_keys an root der IP | | | scp authorized_keys root@xxx.xxx.xxx.xxx: | schickt authorized_keys an root der IP | |
| | scp [quelle] [benutzer]@[zielip]: {{:dwh.gif?300x1|dwh}} | kopiert datei an benutzer der ziel IP {{:dwh.gif?300x1|dwh}} | | | scp [quelle] [benutzer]@[zielip]: | kopiert datei an benutzer der ziel IP | |
| | scp [quelle] [benutzer]@[zielip]:[absoluterZielpfad] | datei an benutzer der ziel IP | | | scp [quelle] [benutzer]@[zielip]:[absoluterZielpfad] | datei an benutzer der ziel IP | |
| |
| mkdir /etc/skel/.ssh | mkdir /etc/skel/.ssh |
| |
| useradd -m -s /bin/bash local_admin-grunwald | useradd -m -s /bin/bash username |
| |
| echo "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAp+i1MhaHDsz8WeHvRohWezjoSYCeNNTB4agYP7ZpxiNIspVScHvyErb0YcGFR5vZypy3kETT9HcQKicRdmMIT6GPAOSPDIASDjdfgdjfASDFBz7kZkzgSisifgoeifqIwPbQbPHeR4yLJreXnbGR4xlifkeM5RoogbD5cvLgdwy78aiKPNZMhCheUd4G8srZQUPdGe+TuW8XdFVdzKEhqqNPZSyulHTy6QASJKDHGWEUDFGWZEFWKUEFHZWEIFHWEFBhsdfhsdfgautvG7GQ6mFn+U/u4PxNmmL5RVgdSFoW8J28ePJl6ckFWMi8yLXcZC+01w== local_admin-grunwald" > /home/local_admin-grunwald/.ssh/authorized_keys | echo "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAp+i1MhaHDsz8WeHvRohWezjoSYCeNNTB4agYP7ZpxiNIspVScHvyErb0YcGFR5vZypy3kETT9HcQKicRdmMIT6GPAOSPDIASDjdfgdjfASDFBz7kZkzgSisifgoeifqIwPbQbPHeR4yLJreXnbGR4xlifkeM5RoogbD5cvLgdwy78aiKPNZMhCheUd4G8srZQUPdGe+TuW8XdFVdzKEhqqNPZSyulHTy6QASJKDHGWEUDFGWZEFWKUEFHZWEIFHWEFBhsdfhsdfgautvG7GQ6mFn+U/u4PxNmmL5RVgdSFoW8J28ePJl6ckFWMi8yLXcZC+01w== username" > /home/username/.ssh/authorized_keys |
| |
| cp /etc/sudoers /etc/sudoers.orig | cp /etc/sudoers /etc/sudoers.orig |
| |
| echo "local_admin-grunwald ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | echo "username ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers |
| |
| cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig | cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig |
| grep "PasswordAuthentication yes" /etc/ssh/sshd_config | sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' /etc/ssh/sshd_config | grep "PasswordAuthentication yes" /etc/ssh/sshd_config | sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' /etc/ssh/sshd_config |
| grep "PermitRootLogin yes" /etc/ssh/sshd_config | sed -i 's/PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config | grep "PermitRootLogin yes" /etc/ssh/sshd_config | sed -i 's/PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config |
| |
| |
| service ssh restart | service ssh restart |
| </code> | </code> |
| |
| ~~DISQUS~~ | |