fachinformatiker-wiki

it's easy when it's here

User Tools

Site Tools


linux:ssh_scp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:ssh_scp [2020/11/20 00:27] – external edit 127.0.0.1linux:ssh_scp [2024/11/29 17:47] (current) – [Script um Public-Key Hinzuzufügen] gsys
Line 2: Line 2:
  
 ===== 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 | |
Line 11: Line 11:
 ===== 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 |
  
Line 21: Line 21:
 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
Line 33: Line 33:
 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~~ 
linux/ssh_scp.1605828424.txt.gz · Last modified: 2024/02/17 19:03 (external edit)