Как программно смонтировать WebDAV в Ubuntu без установки davfs2? - PullRequest
2 голосов
/ 29 февраля 2012

Мне нужно программно смонтировать папку WebDAV в Ubuntu. Я нашел решение, используя davfs2.

Однако davfs2 по умолчанию не установлен в Ubuntu. В то же время меню «Places-> Connect to Server ...» в Gnome может сделать это без установки davfs2. Я предполагаю, что это также не требует привилегий root.

Есть идеи, как смонтировать WebDAV без установки davfs2?

Ответы [ 2 ]

1 голос
/ 29 февраля 2012

Существует инструмент командной строки, который уже установлен в Ubuntu: nd. Но для этого необходимо постоянно вводить имя пользователя и пароль.

Если вы можете собрать из исходного кода клиента WebDAV, например cadaver

Вы можете использовать опцию --prefix в configure и выбрать папку, к которой у вас есть доступ для записи:

./configure --prefix=/home/me/cadaver/
make
make install

cadaver поддерживает автоматический вход на серверы, требующие аутентификации через файл .netrc

0 голосов
/ 13 марта 2017

Ubuntu имеет пакет cadaver , доступный для всех поддерживаемых в настоящее время выпусков, поэтому компиляция не требуется. Вы можете установить его с помощью команды sudo apt-get install cadaver Как указано JScoobyCed"cadaver поддерживает автоматический вход на серверы, требующие аутентификации через файл .netrc"

Вот пара выдержек из справочной страницы:

THE .netrc FILE
       The file ~/.netrc may be  used  to  automatically  login  to  a  server
       requiring  authentication.  The  following tokens (separated by spaces,
       tabs or newlines) may be used:

       machine host
              Identify a remote machine host which is compared with the  host‐
              name  given  on  the  command line or as an argument to the open
              command.  Any subsequent tokens up to the end  of  file  or  the
              next machine or default token are associated with this entry.

       default
              This  is  equivalent  to the machine token but matches any host‐
              name. Only one default token may be used and it  must  be  after
              all machine tokens.

       login username
              Specifies  the  username  to  use  when logging in to the remote
              machine.

       password string
       passwd string
              Specifies the password to use when  logging  in  to  the  remote
              machine.

       Any other tokens (as described in ftp(1)) are ignored.


EXAMPLES
       cadaver http://dav.example.com/
              Connects to the server myserver.example.com, opening the root collection.

   cadaver http://zope.example.com:8022/Users/fred/
          Connects to the server zope.example.com using port 8022, opening the collection "/Users/fred/".

   cadaver https://secure.example.com/
          Connects to a server called secure.example.com using SSL.

FILES
       ~/.cadaverrc
              Individual user settings that can override cadaver defaults and to script cadaver. Can be changed by the "--rcfile" option.

       ~/.netrc
              Login and initialization information used by the auto-login process. See section "THE .netrc FILE" for details.
...