User Tools

Site Tools


doc:appunti:linux:sa:ssh

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:linux:sa:ssh [2021/04/28 10:19] – [SSH su Windows] niccolodoc:appunti:linux:sa:ssh [2022/02/11 11:30] (current) – [rush] niccolo
Line 12: Line 12:
 user=loginname:011:000110: # Allow sftp and scp, no chroot. user=loginname:011:000110: # Allow sftp and scp, no chroot.
 </file> </file>
 +
 +==== 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:
 +
 +<code>
 +apt install openssh-sftp-server
 +</code>
 +
 +quindi si prepara un ambiente chroot che servirà a tenere confinato l'utente remoto che accede via SFTP. La directory **/srv/rush/** occuperà circa **280 Mb** (Debian Buster):
 +
 +<code>
 +apt install rush
 +adduser --uid 1004 --gecos "Special SFTP account" --shell "/usr/sbin/rush" sftp-user
 +mkdir -p /srv/rush/
 +debootstrap buster /srv/rush/
 +</code>
 +
 +Nell'ambiente chroot si eseguono alcune operazioni:
 +
 +<code>
 +chroot /srv/rush
 +
 +apt install locales
 +dpkg-reconfigure locales
 +apt install openssh-sftp-server
 +adduser --uid 1004 --gecos "Special SFTP account" --shell "/bin/false" sftp-user
 +</code>
 +
 +Il file **/etc/rush.rc** dovrà contenere la sezione:
 +
 +<file>
 +rule sftp-rush
 +  command ^.*/sftp-server
 +  uid >= 1000
 +  set[0] /usr/lib/sftp-server
 +  umask 002
 +  chroot /srv/rush
 +  chdir ~
 +</file>
 +
 +Si dovrebbe quindi poter accedere via **sftp**, ma fallire via **ssh**:
 +
 +<code>
 +sftp -P 22 sftp-user@remote.host.com
 +sftp-user@remote.host.com's password: 
 +Connected to sftp-user@remote.host.com.
 +sftp>
 +</code>
 +
 +<code>
 +ssh -p 22 sftp-user@remote.host.com
 +sftp-user@remote.host.com's password: 
 +You do not have interactive login access to this machine.
 +Contact the systems administrator for further assistance.
 +Connection to remote.host.com closed.
 +</code>
  
 ===== SSH su Windows ===== ===== SSH su Windows =====
doc/appunti/linux/sa/ssh.1619597949.txt.gz · Last modified: 2021/04/28 10:19 by niccolo