LinuxForum.Fans
Тема

Sshfs

Автор: zenon 10 сообщений 3207 просмотров
#234899

К примеру это

text
$ sshfs root@192.168.0.5:/mnt /mnt/sshfs

понятно, паролем.
Если есть /root/.ssh/id_rsa - то по ключю, тоже хорошо.
>
Не пойму как сделать тоже, только если ключ называется не id_rsa, а как нибудь иначе, и не из под рута.

#234928

newzenon, сейчас к сожалению проверить не на чем, но в двух словах: если поместить публичный ключ, созданный пользователем локального компьютера, в домашний каталог root'а на удалённом сервере, то можно будет монтировать любую директорию удалённого компьютера.
Файл, по которому будет происходить идентификация, можно указать в ~/.ssh/config, задав переменную IdentityFile.

text

man ssh_config
...
 IdentityFile
             Specifies a file from which the user's DSA, ECDSA or DSA authentication identity is read.  The default is ~/.ssh/identity
             for protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa and ~/.ssh/id_rsa for protocol version 2.  Additionally, any
             identities represented by the authentication agent will be used for authentication.  ssh(1) will try to load certificate
             information from the filename obtained by appending -cert.pub to the path of a specified IdentityFile.

The file name may use the tilde syntax to refer to a user's home directory or one of the following escape characters: ‘%d’ (local user's home directory), ‘%u’ (local user name), ‘%l’ (local host name), ‘%h’ (remote host name) or ‘%r’ (remote user name).

It is possible to have multiple identity files specified in configuration files; all these identities will be tried in sequence. Multiple IdentityFile directives will add to the list of identities tried (this behaviour differs from that of other configuration directives). ...

#234944
Lupo Alberto написал:
Файл, по которому будет происходить идентификация, можно указать в ~/.ssh/config, задав переменную IdentityFile.

абсолютно верно.
Вот пример

text
Host xyz
HostName 192.0.2.1
User user
Port 66666
IdentityFile ~/.ssh/xyz

теперь вместо указания всех этих опций можно писать просто
[console]$ ssh xyz[/console]

#234953
drBatty написал:

теперь вместо указания всех этих опций можно писать просто
[console]$ ssh xyz[/console]

Дык всегда так и делаю.
У меня IdentityFile ~/.ssh/mykey_dsa прописан, только с монтированием sshfs затыки.
Вот допустим

text
Host myhost
   HostName 192.168.0.1
   Port 44535
   IdentityFile ~/.ssh/mykey_dsa
   User user
#234974
newzenon написал:
У меня IdentityFile ~/.ssh/mykey_dsa прописан, только с монтированием sshfs затыки.

что за затыки? по ssh работает, а sshfs нет? наверняка синтаксис.

#234991
text
$ sshfs -o debug zen:/home/john/sshfs_share/ /home/john/sshfsmount/
FUSE library version: 2.8.6
nullpath_ok: 0
subsystem request failed on channel 0
read: Connection reset by peer
john@serv:~$ 

Пользователь в группе fuse, zen - альяс на сервер, tab'ом подсказки каталогов выдает, те удаленный сервер видит и каталоги видит.

#235005

newzenon, ну во первых -o sshfs_debug
во вторых по scp копирует? а в mc?

#235034

drBatty, -o sshfs_debug дает еще меньше иформации:

text
$ sshfs -o sshfs_debug zen:/home/john/sshfs_share/ /home/john/sshfsmount/
SSHFS version 2.3
read: Connection reset by peer
text
john@serv:~$ sshfs -o sshfs_debug zen:sshfs_share/ sshfsmount/
SSHFS version 2.3
read: Connection reset by peer

В mc по альясу - ок.
scp:

text
john@serv:~$ scp DSC08932.JPG  zen:sshfs_share/
DSC08932.JPG                                                100% 1747KB   1.7MB/s   00:01    
john@serv:~$
#235048

newzenon, тогда без понятия :(

#235057

ой ё! smile
На сервере в конфиге /etc/ssh/sshd_config добавил:

text
# override default of no subsystems
Subsystem       sftp    /usr/lib64/misc/sftp-server

И все ок.
drBatty, -o sshfs_debug от -o debug отличается тем что отладка идет в реальном времени, те вместо подключения и выброса в cli постоянно идет отладка, все действия с удаленным каталогом выводит в консоль вот пример:

text
$ sshfs  zen:sshfs_share/ sshfsmount/ -o debug
FUSE library version: 2.8.6
nullpath_ok: 0
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56
INIT: 7.17
flags=0x0000047b
max_readahead=0x00020000
   INIT: 7.12
   flags=0x00000011
   max_readahead=0x00020000
   max_write=0x00010000
   unique: 1, success, outsize: 40

unique: 2, opcode: LOOKUP (1), nodeid: 1, insize: 47 LOOKUP /.Trash getattr /.Trash unique: 2, error: -2 (No such file or directory), outsize: 16 unique: 3, opcode: LOOKUP (1), nodeid: 1, insize: 52 LOOKUP /.Trash-1000 getattr /.Trash-1000 unique: 3, error: -2 (No such file or directory), outsize: 16 unique: 4, opcode: GETATTR (3), nodeid: 1, insize: 56 getattr / unique: 4, success, outsize: 120 unique: 5, opcode: ACCESS (34), nodeid: 1, insize: 48 unique: 5, error: -38 (Function not implemented), outsize: 16 unique: 6, opcode: OPENDIR (27), nodeid: 1, insize: 48 unique: 6, success, outsize: 32 unique: 7, opcode: READDIR (28), nodeid: 1, insize: 80 getdir[0] unique: 7, success, outsize: 120 unique: 8, opcode: READDIR (28), nodeid: 1, insize: 80 unique: 8, success, outsize: 16 unique: 9, opcode: LOOKUP (1), nodeid: 1, insize: 53 LOOKUP /DSC08932.JPG getattr /DSC08932.JPG NODEID: 2 unique: 9, success, outsize: 144 unique: 10, opcode: READDIR (28), nodeid: 1, insize: 80 unique: 10, success, outsize: 16 unique: 11, opcode: RELEASEDIR (29), nodeid: 1, insize: 64 unique: 11, success, outsize: 16 unique: 12, opcode: STATFS (17), nodeid: 1, insize: 40 statfs / unique: 12, success, outsize: 96 unique: 13, opcode: GETATTR (3), nodeid: 1, insize: 56 getattr / unique: 13, success, outsize: 120 unique: 14, opcode: LOOKUP (1), nodeid: 1, insize: 48 LOOKUP /.hidden getattr /.hidden unique: 14, error: -2 (No such file or directory), outsize: 16 unique: 15, opcode: OPENDIR (27), nodeid: 1, insize: 48 unique: 15, success, outsize: 32 unique: 16, opcode: LOOKUP (1), nodeid: 1, insize: 47 LOOKUP /.Trash getattr /.Trash unique: 16, error: -2 (No such file or directory), outsize: 16 unique: 17, opcode: LOOKUP (1), nodeid: 1, insize: 52 LOOKUP /.Trash-1000 getattr /.Trash-1000 unique: 17, error: -2 (No such file or directory), outsize: 16 unique: 18, opcode: READDIR (28), nodeid: 1, insize: 80 getdir[0] unique: 18, success, outsize: 120 unique: 19, opcode: READDIR (28), nodeid: 1, insize: 80 unique: 19, success, outsize: 16 unique: 20, opcode: LOOKUP (1), nodeid: 1, insize: 53 LOOKUP /DSC08932.JPG getattr /DSC08932.JPG NODEID: 2 unique: 20, success, outsize: 144 unique: 21, opcode: GETATTR (3), nodeid: 1, insize: 56 getattr / unique: 21, success, outsize: 120 unique: 22, opcode: READDIR (28), nodeid: 1, insize: 80 unique: 22, success, outsize: 16 unique: 23, opcode: RELEASEDIR (29), nodeid: 1, insize: 64 unique: 23, success, outsize: 16 unique: 24, opcode: STATFS (17), nodeid: 1, insize: 40 statfs / unique: 24, success, outsize: 96 unique: 25, opcode: OPEN (14), nodeid: 2, insize: 48 open flags: 0x8000 /DSC08932.JPG open[31836208] flags: 0x8000 /DSC08932.JPG unique: 25, success, outsize: 32 unique: 26, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 16384 bytes from 0 flags: 0x8000 read[31836208] 16384 bytes from 0 unique: 26, success, outsize: 16400 unique: 27, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 32768 bytes from 16384 flags: 0x8000 unique: 28, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 49152 flags: 0x8000 read[31836208] 32768 bytes from 16384 unique: 27, success, outsize: 32784 unique: 30, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 180224 flags: 0x8000 unique: 29, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 114688 flags: 0x8000 read[31836208] 65536 bytes from 49152 unique: 28, success, outsize: 65552 unique: 31, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 245760 flags: 0x8000 unique: 32, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 311296 flags: 0x8000 read[31836208] 65536 bytes from 180224 unique: 30, success, outsize: 65552 read[31836208] 65536 bytes from 114688 unique: 29, success, outsize: 65552 read[31836208] 65536 bytes from 245760 unique: 31, success, outsize: 65552 read[31836208] 65536 bytes from 311296 unique: 32, success, outsize: 65552 unique: 33, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 376832 flags: 0x8000 unique: 34, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 442368 flags: 0x8000 unique: 35, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 507904 flags: 0x8000 unique: 36, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 573440 flags: 0x8000 read[31836208] 65536 bytes from 376832 unique: 33, success, outsize: 65552 read[31836208] 65536 bytes from 442368 unique: 34, success, outsize: 65552 read[31836208] 65536 bytes from 507904 unique: 35, success, outsize: 65552 unique: 37, opcode: READ (15), nodeid: 2, insize: 80 unique: 38, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 704512 flags: 0x8000 read[31836208] 65536 bytes from 573440 unique: 36, success, outsize: 65552 read[31836208] 65536 bytes from 638976 flags: 0x8000 read[31836208] 65536 bytes from 704512 unique: 38, success, outsize: 65552 unique: 39, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 770048 flags: 0x8000 unique: 40, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 835584 flags: 0x8000 read[31836208] 65536 bytes from 638976 unique: 37, success, outsize: 65552 read[31836208] 65536 bytes from 770048 unique: 39, success, outsize: 65552 read[31836208] 65536 bytes from 835584 unique: 40, success, outsize: 65552 unique: 41, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 901120 flags: 0x8000 unique: 42, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 966656 flags: 0x8000 read[31836208] 65536 bytes from 901120 unique: 41, success, outsize: 65552 unique: 44, opcode: READ (15), nodeid: 2, insize: 80 unique: 43, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 1097728 flags: 0x8000 read[31836208] 65536 bytes from 1032192 flags: 0x8000 read[31836208] 65536 bytes from 966656 unique: 42, success, outsize: 65552 read[31836208] 65536 bytes from 1097728 unique: 44, success, outsize: 65552 unique: 46, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 1228800 flags: 0x8000 unique: 45, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 1163264 flags: 0x8000 read[31836208] 65536 bytes from 1032192 unique: 43, success, outsize: 65552 read[31836208] 65536 bytes from 1228800 unique: 46, success, outsize: 65552 read[31836208] 65536 bytes from 1163264 unique: 45, success, outsize: 65552 unique: 47, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 1294336 flags: 0x8000 unique: 48, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 1359872 flags: 0x8000 read[31836208] 65536 bytes from 1294336 unique: 47, success, outsize: 65552 unique: 49, opcode: READ (15), nodeid: 2, insize: 80 unique: 50, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 1425408 flags: 0x8000 read[31836208] 65536 bytes from 1490944 flags: 0x8000 read[31836208] 65536 bytes from 1359872 unique: 48, success, outsize: 65552 read[31836208] 65536 bytes from 1425408 unique: 49, success, outsize: 65552 unique: 51, opcode: READ (15), nodeid: 2, insize: 80 unique: 52, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 1622016 flags: 0x8000 read[31836208] 65536 bytes from 1556480 flags: 0x8000 read[31836208] 65536 bytes from 1490944 unique: 50, success, outsize: 65552 read[31836208] 65536 bytes from 1622016 unique: 52, success, outsize: 65552 unique: 53, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 65536 bytes from 1687552 flags: 0x8000 unique: 54, opcode: READ (15), nodeid: 2, insize: 80 read[31836208] 36864 bytes from 1753088 flags: 0x8000 read[31836208] 65536 bytes from 1556480 unique: 51, success, outsize: 65552 read[31836208] 65536 bytes from 1687552 unique: 53, success, outsize: 65552 read[31836208] 35876 bytes from 1753088 unique: 54, success, outsize: 35892 unique: 55, opcode: GETATTR (3), nodeid: 2, insize: 56 fgetattr[31836208] /DSC08932.JPG unique: 55, success, outsize: 120 unique: 56, opcode: FLUSH (25), nodeid: 2, insize: 64 flush[31836208] unique: 56, success, outsize: 16 unique: 57, opcode: RELEASE (18), nodeid: 2, insize: 64 release[31836208] flags: 0x8000 unique: 57, success, outsize: 16 unique: 58, opcode: GETATTR (3), nodeid: 1, insize: 56 getattr / unique: 58, success, outsize: 120 unique: 59, opcode: LOOKUP (1), nodeid: 1, insize: 47 LOOKUP /.Trash getattr /.Trash unique: 59, error: -2 (No such file or directory), outsize: 16 unique: 60, opcode: LOOKUP (1), nodeid: 1, insize: 52 LOOKUP /.Trash-1000 getattr /.Trash-1000 unique: 60, error: -2 (No such file or directory), outsize: 16 ^Cremote host has disconnected

Войдите или зарегистрируйтесь, чтобы ответить.