autofs는 sshfs 지점을 마운트하지 않지만 sshfs 및 mount -t 퓨즈는 마운트합니다.

autofs는 sshfs 지점을 마운트하지 않지만 sshfs 및 mount -t 퓨즈는 마운트합니다.

여러분. 최근에 나는 autofs를 접했고 이제 일상 생활을 더 쉽게 만들려고 노력하고 있습니다. 나는 수년 동안 sshfs의 도움으로 파일을 공유할 때 사용하는 원격 서버를 가지고 있습니다. 그래서 autofs의 도움으로 sshfs를 자동화하는 방법에 대한 몇 가지 튜토리얼을 찾았습니다. 내 구성은 다음과 같습니다.

자동.마스터:

/home/user/autofs/ /etc/autofs/auto.sshfs uid=1000,gid=1000,--timeout=300,--ghost

자동.sshfs:

cux -fstype=fuse,port=222,rw,nodev,noatime,allow_other,IdentityFile=/home/user/.ssh/id_rsa :sshfs\#[email protected]\:/path/to/files

원격 서버는 SSH 키만 허용하므로 마운트 지점에 액세스하려는 사용자는 가져온 키로 실행 중인 SSH-agent를 갖게 됩니다.

그러나 마운트 지점에 액세스하려고 하면 다음과 같은 결과가 나타납니다.

Dec 31 18:56:37 ice automount[25565]: mount(generic): calling mount -t fuse -o uid=1000,gid=1000,port=222,rw,nodev,noatime,allow_other,IdentityFile=/home/user/.ssh/id_rsa sshfs#[email protected]:/path/to/files /home/user/autofs/cux
Dec 31 18:56:37 ice automount[25565]: spawn_mount: mtab link detected, passing -n to mount
Dec 31 18:56:37 ice automount[25565]: >> read: Connection reset by peer
Dec 31 18:56:37 ice automount[25565]: mount(generic): failed to mount sshfs#[email protected]:/path/to/files (type fuse) on /home/user/autofs/cux
Dec 31 18:56:37 ice automount[25565]: dev_ioctl_send_fail: token = 67
Dec 31 18:56:37 ice automount[25565]: failed to mount /home/user/autofs/cux

그러나 sshfs를 사용하여 마운트하는 경우(내 사용자로부터):

sshfs -p 222 server.com:/path/to/files /home/user/remote/cux -o reconnect

성공합니다. autofs가 루트에서 실행되는 autofs와 정확히 동일한 명령을 사용하더라도 다음과 같습니다.

mount -t fuse -o uid=1000,gid=1000,port=222,rw,nodev,noatime,allow_other,IdentityFile=/home/user/.ssh/id_rsa sshfs#[email protected]:/path/to/files /home/user/autofs/cux

그것도 성공합니다. 하지만 문제는 SSH 키인 것 같습니다. 가져온 사용자 키가 없는 루트에서 mount 명령을 실행하면(su -) 비밀번호를 묻는 메시지가 표시됩니다. 이 문제를 해결하고 autofs가 마운트 지점에 액세스하는 사용자의 SSH 키를 사용하도록 하는 방법이 있습니까?

관련 정보