Estou tentando configurar a montagem automática de diretórios base de usuários usando pam_mount
e sshfs (os usuários são usuários LDAP na máquina remota).
Eu configurei pam_mount
:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">
<pam_mount>
<debug enable="1" />
<mntoptions allow="nosuid,nodev,loop,encryption,fsck,nonempty,allow_root,allow_other" />
<mntoptions require="nosuid,nodev" />
<logout wait="0" hup="0" term="0" kill="0" />
<mkmountpoint enable="1" remove="true" />
<volume fstype="fuse" path="sshfs#%(USER)@HOSTNAME:" mountpoint="~" ssh="1" options="reconnect,idmap=user,password_stdin,nonempty" />
</pam_mount>
Quando estou tentando su
para o usuário, sou questionado sobre senha:
root@debian:~# su - pszubert
pam_mount(pam_mount.c:553): pam_mount 2.5: entering session stage
reenter password for pam_mount:
pam_mount(misc.c:38): Session open: (ruid/rgid=0/20001, e=0/20001)
pam_mount(mount.c:213): Mount info: globalconf, user=pszubert <volume fstype="fuse" server="(null)" path="sshfs#pszubert@HOST:" mountpoint="/home/pszubert" cipher="(null)" fskeypath="(null)" fskeycipher="(null)" fskeyhash="(null)" options="reconnect,idmap=user,password_stdin,nonempty" /> fstab=0 ssh=1
command: 'pmt-fd0ssh' 'mount.fuse' 'sshfs#pszubert@HOST:' '/home/pszubert' '-oreconnect,idmap=user,password_stdin,nonempty'
pam_mount(spawn.c:108): setting uid to user pszubert
pam_mount(misc.c:38): set_myuid<post>: (ruid/rgid=20001/20001, e=20001/20001)
System plików Typ bl. 1K B użyte dostępne %uż. zamont. na
/dev/sda1 ext3 7867856 940236 6527956 13% /
tmpfs tmpfs 192316 0 192316 0% /lib/init/rw
proc proc 0 0 0 - /proc
sysfs sysfs 0 0 0 - /sys
udev tmpfs 187872 148 187724 1% /dev
tmpfs tmpfs 192316 0 192316 0% /dev/shm
devpts devpts 0 0 0 - /dev/pts
fusectl fusectl 0 0 0 - /sys/fs/fuse/connections
pam_mount(pam_mount.c:521): mount of sshfs#pszubert@HOST: failed
command: 'pmvarrun' '-u' 'pszubert' '-o' '1'
pam_mount(misc.c:38): set_myuid<pre>: (ruid/rgid=0/20001, e=0/20001)
pam_mount(misc.c:38): set_myuid<post>: (ruid/rgid=0/20001, e=0/20001)
pmvarrun(pmvarrun.c:248): parsed count value 0
pam_mount(pam_mount.c:440): pmvarrun says login count is 1
pam_mount(pam_mount.c:643): done opening session (ret=0)
No HOST auth.log
, há informações:
Mar 17 22:13:42 student sshd[17889]: Accepted password for pszubert from 85.202.159.212 port 20264 ssh2
Mar 17 22:13:42 student sshd[17889]: pam_unix(sshd:session): session opened for user pszubert by (uid=0)
Mar 17 22:13:42 student sshd[17891]: subsystem request for sftp
Mar 17 22:13:42 student sshd[17891]: Received disconnect from XXXXXXXXXX: 11: disconnected by user
Mar 17 22:13:42 student sshd[17889]: pam_unix(sshd:session): session closed for user pszubert
O que é estranho quando estou logado, posso montar o fs remoto usando sshfs pszubert@HOST: a/
.
O que há de errado?
Eu acho que o problema é com ~/.ssh
na máquina local. O primeiro problema foi sobre known_hosts
file, então criei global known_hosts
in /etc/ssh/ssh_known_hosts
. Agora ~/.ssh
ainda é criado, mas está vazio mesmo se eu me conectar ao host remoto manualmente. Eu acho que se eu pudesse evitar de criação ~/.ssh
resolveria problema. Existe uma maneira de desativá-lo?