(SFTP + SSHFS + autofs) + clés SSH ?

Bonjour à tous,

Via ce tuto j’ai installé sur l’un de mes serveurs un accès SFTP qui fonctionne.

Pour plus de sécurité, mes utilisateurs SFTP sont tous en /bin/false au niveau du /etc/passwd et, histoire de leur faciliter la vie, j’ai aussi installé autofs afin qu’ils n’aient qu’à cliquer sur un dossier pour accèder à leur compte SFTP respectif.

Pour mes tests, j’ai utilisé la paire de clé publique/privée SSH de root pour le montage via autofs, mais maintenant je voudrais n’utiliser que les clés SSH de mes utilisateurs.

Question
:
Ces derniers n’ayant pas de Shell, comment leur créer une paire de clé publique/privée ?
Est-ce tout simplement possible car je n’ai trouvé personne sur le Net qui aborde précisément ce sujet ?

Merci d’avance pour votre aide et vos conseils,
Trululu

Salut,

Depuis le compte utilisateur Trululu ?

[mono]:~$ time ssh-keygen -b echo $[1024*16]
Generating public/private rsa key pair.
Enter file in which to save the key (/home/Trululu¹/.ssh/id_rsa):[/mono]

Note : par défaut [mono]/home/Trululu/.ssh/[/mono]

À ta charge de spécifier le lieu¹ en t’assurant des droits réciproques pour ce faire.

Crées le répertoire .ssh préalablement.

[mono]/home/titi¹/.ssh/id_rsa)
/home/toto¹/.ssh/id_rsa)
/home/tata¹/.ssh/id_rsa)[/mono]


PS : tu peux d’ailleurs pousser le bouchon plus loin …

[mono]$ man ssh-keygen[/mono]

[quote]CERTIFICATES
ssh-keygen supports signing of keys to produce certificates that may be used for user or host authentication. Certificates consist of a public key,
some identity information, zero or more principal (user or host) names and a set of options that are signed by a Certification Authority (CA) key.
Clients or servers may then trust only the CA key and verify its signature on a certificate rather than trusting many user/host keys. Note that
OpenSSH certificates are a different, and much simpler, format to the X.509 certificates used in ssl(8).

 [b]ssh-keygen supports two types of certificates: user and host.  User certificates authenticate users to servers, whereas host certificates authenti‐
 cate server hosts to users.[/b]  To generate a user certificate:

$ ssh-keygen -s /path/to/ca_key -I key_id /path/to/user_key.pub
The resultant certificate will be placed in /path/to/user_key-cert.pub. A host certificate requires the -h option:

 The host certificate will be output to /path/to/host_key-cert.pub.

[…]

 [b]Certificates may be limited to be valid for a set of principal (user/host) names.  By default, generated certificates are valid for all users or
 hosts.  To generate a certificate for a specified set of principals:[/b]

       [code]

$ ssh-keygen -s ca_key -I key_id -n user1,user2 user_key.pub
$ ssh-keygen -s ca_key -I key_id -h -n host.domain user_key.pub[/code]

 Additional limitations on the validity and use of user certificates may be specified through certificate options.  A certificate option may disable
 features of the SSH session, may be valid only when presented from particular source addresses or may force the use of a specific command.  For a
 list of valid certificate options, see the documentation for the -O option above.

[…]

 For certificates to be used for user or host authentication, the CA public key must be trusted by sshd(8) or ssh(1).  Please refer to those manual
 pages for details.[/quote]