doc:appunti:linux:sa:ssh
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| doc:appunti:linux:sa:ssh [2007/09/29 14:50] – external edit 127.0.0.1 | doc:appunti:linux:sa:ssh [2022/02/11 11:30] (current) – [rush] niccolo | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== SSH e SFTP ====== | ====== SSH e SFTP ====== | ||
| + | |||
| + | ===== sftp e rssh ===== | ||
| Per poter effettuare **sftp** è necessario avere una shell valida, per evitare di dare accesso shell completo si può utilizzare **rssh**, una shell ridotta che dovrebbe consentire solo scp, sftp, cvs, rsync e rdist. | Per poter effettuare **sftp** è necessario avere una shell valida, per evitare di dare accesso shell completo si può utilizzare **rssh**, una shell ridotta che dovrebbe consentire solo scp, sftp, cvs, rsync e rdist. | ||
| Line 5: | Line 7: | ||
| In teoria l' | In teoria l' | ||
| - | Nel file di configurazione **''/ | + | Nel file di configurazione **''/ |
| + | |||
| + | < | ||
| + | user=loginname: | ||
| + | </ | ||
| + | |||
| + | ==== rush ==== | ||
| + | |||
| + | In **Debian 10 Buster** non esiste il pacchetto **rssh**, al suo posto troviamo **rush**. Segue una breve ricetta su come attivare un ambiente **rush** per un utente, limitato a **ricevere dei file via sftp**. | ||
| + | |||
| + | Si installa il server SFTP: | ||
| + | |||
| + | < | ||
| + | apt install openssh-sftp-server | ||
| + | </ | ||
| + | |||
| + | quindi si prepara un ambiente chroot che servirà a tenere confinato l' | ||
| + | |||
| + | < | ||
| + | apt install rush | ||
| + | adduser --uid 1004 --gecos " | ||
| + | mkdir -p / | ||
| + | debootstrap buster / | ||
| + | </ | ||
| + | |||
| + | Nell' | ||
| + | |||
| + | < | ||
| + | chroot /srv/rush | ||
| + | |||
| + | apt install locales | ||
| + | dpkg-reconfigure locales | ||
| + | apt install openssh-sftp-server | ||
| + | adduser --uid 1004 --gecos " | ||
| + | </ | ||
| + | |||
| + | Il file **/ | ||
| + | |||
| + | < | ||
| + | rule sftp-rush | ||
| + | command ^.*/ | ||
| + | uid >= 1000 | ||
| + | set[0] / | ||
| + | umask 002 | ||
| + | chroot /srv/rush | ||
| + | chdir ~ | ||
| + | </ | ||
| + | |||
| + | Si dovrebbe quindi poter accedere via **sftp**, ma fallire via **ssh**: | ||
| + | |||
| + | < | ||
| + | sftp -P 22 sftp-user@remote.host.com | ||
| + | sftp-user@remote.host.com' | ||
| + | Connected to sftp-user@remote.host.com. | ||
| + | sftp> | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | ssh -p 22 sftp-user@remote.host.com | ||
| + | sftp-user@remote.host.com' | ||
| + | You do not have interactive login access to this machine. | ||
| + | Contact the systems administrator for further assistance. | ||
| + | Connection to remote.host.com closed. | ||
| + | </ | ||
| + | |||
| + | ===== SSH su Windows ===== | ||
| + | |||
| + | Dopo aver installato il programma con l' | ||
| + | |||
| + | L' | ||
| + | |||
| + | //Control Panel// -> // | ||
| + | |||
| + | * Adjust memory quotas for a process | ||
| + | * Create a token object | ||
| + | * Logon as a service | ||
| + | * Replace a process level token | ||
| + | |||
| + | Su Windows 2003 Server i permessi devono essere assegnati manualmente. La procedura '' | ||
| + | |||
| + | Se si vuole eseguire '' | ||
| + | |||
| + | < | ||
| + | sc \\server_name delete sshd | ||
| + | </ | ||
| + | |||
| + | ===== Affidabilità di rsync su ssh ===== | ||
| + | |||
| + | Se si esegue un rsync di grosse quantità di dati su connessione ssh e la linea non è molto affidabilie, | ||
| + | |||
| + | Con opportune opzioni si dovrebbe aumentare l' | ||
| + | |||
| + | <code bash> | ||
| + | # ServerAliveInterval and ServerAliveCountMax: | ||
| + | # * Terminate the session if server does not respond for 4 min: | ||
| + | # 15 x 20 = 300 s => 5 min | ||
| + | # | ||
| + | # TCPKeepAlive: | ||
| + | # * Detect TCP/IP network down (also temporary). | ||
| + | # | ||
| + | # IPQoS | ||
| + | # * IPv4 type-of-service | ||
| + | |||
| + | SSH_OPTIONS=' | ||
| + | |||
| + | rsync -avz --delete -e "ssh $SSH_OPTIONS" | ||
| + | </ | ||
doc/appunti/linux/sa/ssh.1191070212.txt.gz · Last modified: (external edit)
