Hardware and software setup

Console client for Linux. Guide for connecting Yandex disk in Linux Does the console client support working with symbolic links

Over two years ago, I wrote an article that became quite popular. During this time, appeared in Runet cloud service. Probably everyone has heard of him. In today's article I want to tell How do I use Yandex.Disk.

Before the advent of Yandex.Disk, I used various ways, to store your files in the cloud and, if necessary, send them to someone else. I described them in the article “Methods for transferring large files on the Internet”.

When I started my blog, it became necessary to share files not only with my friends, but with all readers. For example, it was necessary to put in general access a folder with wallpapers for your desktop or some utility, and give a download link to everyone. As a result, at that moment I stopped at the service Yandex.People.

In 2013, Yandex closed this service. Therefore, I transferred all the files for downloading to Yandex.Disk, which I do not regret at all and recommend it to everyone.

Of course, most Internet users know about Yandex.Disk and many use it. For those who have not yet appreciated all the advantages this service, I'll tell you a little about it.

In order for you to be able to upload your files to the service, you must have Yandex mailbox(for downloading files - this is not necessary either). If you already have it, just go to your mail in the “Disk” tab: The service is completely free, however, it is possible to increase the available disk space for a fee. For me personally, available on Yandex.Disk free space more than enough. Initially, 3 GB of space is provided, which can be very easily increased up to 10 GB. To do this, you will need to install Yandex.Disk client program to your computer (we will get 3 GB of space for this); then upload a couple of any files with it (another +2 GB); and then tell a friend about the service by sharing the link in one of the social networks (+2 GB).

If the available 10 GB of space seems not enough for you, then you can increase it by another 10 GB for free. To do this, you will have to invite friends by sending them links. For each such friend who follows your link and installs the Yandex.Disk program, you can receive 512 MB of disk space.

Although using the Yandex.Disk client on a computer or other device is quite a convenient thing, I personally use the service only via web interface. Therefore, having received my 10 GB of space, I deleted the program from the computer 🙂.

How do I "share" or open public access to the desired file?

First, we go through any browser on any computer to our mailbox from Yandex - then go to the “Disk” tab:
We press the button " Download”: Next we find on the computer desired file- select it and click "Open".

Select the downloaded file - then switch the toggle switch on the right from the “Off” to “On” position and copy the public link that appears:
Well, then we send this link in any known way to whomever we want (by mail, via social network, skype, etc.). I publish this link in the corresponding article on the blog.

Developers are constantly improving the Yandex.Disk service. Since its launch in 2012, it has gained many new features: viewing documents without downloading, integration into the office suite Microsoft Office 2013, ability to share folders with other users, screenshot editor, ability to automatic download photos and video files from digital cameras to Yandex.Disk and much more. About all the innovations in the work of the service, the developers report on

Yandex Disk cloud storage can be connected to your computer as a network drive using the WebDAV protocol. After connection network drive, you will be able to work with Yandex cloud storage from your computer, just like with a regular disk in operating system Windows.

In Yandex.Disk, you can store your files in the "cloud" by interacting with the storage using special program-client, or managing your data through a web interface using a browser for this.

When using a special program from Yandex, your files will be stored simultaneously on your computer and in the cloud storage, and when using the web interface, your data will be stored only in the cloud storage.

You can also use Yandex.Disk as a network drive. This will allow you to access your cloud storage files directly in File Explorer. The Drive will be connected to the computer using the WebDAV protocol.

Network Drive by WebDAV

WebDAV (Web-based Distributed Authoring and Versioning) - translates something like this: web tools for distributed development and version control. This is a set of extensions that are installed on top of HTTP protocol, which allow users to co-edit and manage files on a remote web server.

After connecting Yandex.Disk as a network drive to your computer, you will get access to all the contents of the cloud storage in this account. In this case, Yandex.Disk connected via WebDAV will be available only when an Internet connection is connected. If Internet access is disabled, then in this case, access to the network drive will be terminated.

Another feature of using Yandex.Disk via the WebDAV protocol is that all data from this cloud storage will be located in the "cloud" and not on your computer. You work with cloud storage like a regular disk on your computer, while all data will be physically located on a remote Yandex server.

If a client program is already installed on your computer and you use cloud storage on your computer, then when connecting Yandex.Disk via WebDAV, you can additionally connect a network drive with your other Yandex cloud storage to your computer.

You can have several cloud storages in Yandex. This is a fairly common occurrence, since many users may have several email accounts in Yandex. Yandex.Disk is tied to an email account, so these users will automatically have several cloud storages that they can use.

How to connect Yandex.Disk as a network drive to a Windows computer

To map a network drive in the operating Windows system, you must first click right click by the "Computer" or "This Computer" icon on the desktop or from the "Start" menu. Then you will need to select the context menu item "Connect a network drive ...".

In another way, it will be possible to connect a network drive from the Explorer window, open in the "Computer" tab. There you will need to select "Map network drive".

Next, the "Map network drive" window will open. In this window, you must select a letter for the new network drive. By default, Windows automatically selects a free letter of the alphabet. You can change the drive letter if you need to.

In the "Folder" field, you will need to enter the following address:

https://webdav.yandex.ru

By default, the "Restore at login" option is enabled.

After completing the selection of settings, click on the "Finish" button.

After successfully connecting the network drive, the "Windows Security" window will open.

Here, in the "User" field, you will need to enter the login from your account in Yandex.Disk. Since the login is tied to a mailbox in Yandex, please note that in this case, you will need to enter an incomplete address Email, but only the login (what comes before "dog").

In the "Password" field, enter the password for your account. Then, activate the "Remember credentials" item in order not to re-enter your data every time you connect to a network drive. Next, click on the "OK" button.

After that, the Explorer window will open cloud storage Yandex.Disk. All files and folders that are located in this particular cloud storage will be displayed here.

In the Explorer window, all network drives connected to your computer will be displayed in the "Network Locations" area.

Now you can use the Yandex cloud like a regular disk on your computer.

How to disable Yandex WebDAV network drive

To disconnect the webdav yandex disk from the computer, you will first need to click on the "Computer" or "This PC" icon, and then in context menu Select "Disable Network Drive...".

In the Network Drives window that opens, you will need to select desired disk, and then click on the "OK" button.

After that, the Yandex.Disk network drive will be disconnected from your computer.

Article Conclusions

The user can connect the Yandex.Disk cloud storage to his computer as a network drive using the WebDAV protocol. In this case, you will use the remote "cloud" as a network drive. At the same time, your files will be physically located on a remote server, and you will be able to work with them as on a regular disk of your computer.

Experienced PC and Internet user

In this article, we will make Yandex c Linux related, or rather, connect Yandex disk in Linux as local folder. We implement access to Yandex disk from Linux using the WebDAV protocol, everything is done quite simply.

Access to Yandex disk in Linux can be implemented in several ways.

  1. The first way to connect to Yandex disk.

Can be done using the standard file manager used in Linux distribution, be it Dolphin (KDE), Nautilus (Unity or Gnome), Nemo (Cinnamon), Caja (Mate), Thunar (Xfce) or PCManFM (LXDE), in short, all those that support WebDAV technology.

To do this, in the address bar of the file manager, switch from the view of icons (buttons) to the view of a text line so that you can write the following address:

davs:// [email protected]/

Where user must be replaced with your Yandex login and click , after which you must enter a password. Here you can make a choice in the dialog box, when entering a password, indicating "remember forever". After connecting Yandex disk to the Linux file manager, you can bookmark , after restarting the system, you will have a bookmark for mounting Yandex clouds.

  1. The second way to connect a Yandex disk in Linux is the davfs2 utility, which can be found in every distribution.

To install davfs2 on Ubuntu, the command would be:

sudo apt-get install davfs2

Setting up davfs2 to mount a Yandex disk in Linux

We create a directory in Linux where Yandex disk will be mounted. I suggest creating it in the /media directory:

Sudo mkdir /media/yandex_disk

With the next command, we mount the disk to the created directory by entering our login and password from Yandex account, and grant rights to our user:

sudo mount -t davfs https://webdav.yandex.ru /media/yandex_disk && sudo chown -R pavel /media/yandex_disk

(instead of pavel we write the name of our user)

Check disk connection:

Sudo echo "https://webdav.yandex.ru username password" >> /etc/davfs2/secrets

(username password - you must enter your own).

The login and password for connecting to Yandex disk can always be changed in the /etc/davfs2/secrets file with your favorite text file editor.

And finally, we finish setting up the Yandex disk by automatically connecting it after the system starts. To do this, add the following to the end of the /etc/fstab file:

https://webdav.yandex.ru:443 /media/yandex_disk davfs user,noauto 0 0

Now you can add your user to the group: davfs2

Sudo adduser pavel davfs2

(pavel to change to his own).

Well, in the end, we change the rights to the mount.davfs file with the following command:

sudo chmod 4755 /usr/sbin/mount.davfs

After a reboot, a mount point should appear in the file manager.

  1. The third way is not quite Linux, but something in the style of Windows.

Why do I treat him like this? Because this package is not from the repository, which means that the entire responsibility for the security of the system when installing packages from non-Linux repositories lies on your conscience. Your system keeps track of updating these packages, it will not be able to, which means that these software packages will remain in this state from the moment of installation.

However, it will be easier for someone to set up access, so all manipulations are minimal, click on the package and go.

Benefits of webdav access over web access:

  • working with files in automatic mode (downloading/uploading bat files and JS/VBS/PS scripts), that is, first of all, this means the ability to automatically reset backups to online storage
  • connecting the cloud as a network drive (normal network drive) with the assignment of a logical drive letter (E:, F:, etc.), in other words, the ability to work with cloud files from regular programs(office packages, graphic editor etc.)
  • the ability to upload large files (usually the web interface allows you to upload files up to 2 GB to the storage). It should be noted here that free accounts are often limited in file size compared to paid ones, for example, on Box you can store files no larger than 250 MB for free (on Business accounts, the file size can be up to 5 GB, on Enterprise, like up to 15 GB); true, with big files there are other problems, but more on that below

The article will talk about the possibilities of using WebDAV in various programs, connection features manually and from the command line / bat files, common problems and their solutions.

WebDAV in FAR Manager

You can work with file storage via WebDAV without connecting a network drive if you use the NetBox plugin in Far Manager, while the files will be available in Far Manager itself, but inaccessible in the command line and in other programs, for example, in Windows Explorer.

Mapping a WebDAV Network Drive

This windows function allows you to access files via WebDAV not only in file managers(Far Manager, etc.), but also on the command line and in Windows Explorer.

Windows 7 has a built-in web client that mounts the WebDAV cloud like a regular network drive with a letter assignment. When connecting, you must enter an address that depends on the storage.

WebDAV connection string for Yandex.Disk: https://webdav.yandex.ru
WebDAV Connection String for Box: https://dav.box.com/dav
The WebDAV connection string for OneDrive will require cid - this is the account ID, you can see it in the address bar of the browser on the OneDrive page: https://d.docs.live.net/ cid
The Mail.ru cloud also offers WebDAV access, although only on paid plans, the WebDAV connection string for Mail.ru: https://webdav.cloud.mail.ru/

Connecting WebDAV from the Windows command line

You can also use the command line capabilities - the NET USE command successfully connects WebDAV storages, for example, this command connects the Yandex.Disk folder as a logical drive Y:

password/user: email_address/persistent:yes

This command is to mount the Box folder as logical drive X:

Net use X: https://dav.box.com/dav password/user: email_address/persistent:yes

To connect OneDrive to the letter O: (cid value is taken from address bar browser in the OneDrive web interface:

Net use O: https://d.docs.live.net/ cid password/user: email_address/persistent:yes

To mount OneDrive to an automatically assigned drive letter:

Net use * https://d.docs.live.net/ cid password/user: email_address/persistent:yes

Although you can choose automatic selection drive letters (indicating an asterisk), I prefer to use fixed letters - this makes it easier to work with batch files.

Note: the /persistent:yes parameter is optional, it sets the connection to be automatically restored when the computer is restarted, see below for more details.

After connecting, you can use standard commands for working with files, for example:

Copy backup.zip y:\backup

Problems with large files

Operations (downloads, uploads) on small files are fine. However, if the file size is larger (50 MB or more), there are problems. For example, the message appears Delayed Write Failed (Delayed Write Error), and the size of the uploaded file is 0 bytes.

But in reality it turned out to upload a 300 MB file only xcopy command with buffering disabled:

Copying completed successfully, despite the fact that it did not work Windows Explorer, nor copy /y /z /v.

File size limit

The original value is 50,000,000 bytes. Specified in bytes by the registry setting:

DWORD FileSizeLimitInBytes

in section:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters

For example, you can enter 500,000,000.

Time-out

The initial value is 1800 seconds or 30 minutes, so operations over 30 minutes are aborted. The timeout value is set in seconds by the registry value:

DWORD FsCtlRequestTimeoutInSec

in section:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MRxDAV\Parameters

wevdav storage performance

This is a very interesting question for backup, because we need to understand how long it will take to copy the backup file to the server via webdav, because the size of such a file can be 100MB, or 1GB or more.

The following test shows the upload time of a 188 MB file to Yandex Disk via webdav. Internet connection is 100 Mbps, so uploading is not significantly affected. The program nhts is used to register the start and end times of copying.

C:\Users\username\Documents>dir *.zip 09/11/2015 03:55 PM 197 858 220 backup-20150911.zip C:\Users\username\Documents>nhts HH:mm:ss "Launch" & xcopy backup-2015091 1.zip y:\backup /Y /Z /V /J & nhts HH:mm:ss "Completed" 15:58:05 Running C:backup-20150911.zip Files copied: 1. 15:58:43 Completed

As a result, a 188 MB file was copied in 38 seconds, that is, the upload speed was 4.9 MB / s or 40 Mbps - good result for backup. Accordingly, a 1 GB file will be uploaded to the server in about 3.5 minutes.

Now the same test for Box (it's connected to X:):

C:\Users\username\Documents>nhts HH:mm:ss "Starting" & xcopy backup-2015091 1.zip x:\backup /Y /Z /V /J & nhts HH:mm:ss "Done" 16: 09:57 Launch C:backup-20150911.zip Files copied: 1. 16:11:49 Completed

Box works slower - the copy time of the same file was 112 seconds, and, accordingly, the copy speed was 1.7 MB / s or 13.4 Mbps. At this speed, the time to copy a 1GB file will be more than 10 minutes. Box itself writes that for business and enterprise accounts there is some kind of optimization to increase the speed of copying to the server, see How can I optimize my upload speeds?

It is clear that the copying speed may vary depending on the load of communication channels or servers, but it is clear that Yandes Disk is faster, and given the 250 MB file size limit in Box, it is preferable to use free Yandex drive than free account box.

Possible problems and solutions

When a connection problem occurs, it is important to determine what kind of error the program reports - in order to do right action to eliminate it.

Error 67 - Network name not found

Error 67 means that the server could not be found by the network name specified in the command. In English Windows versions this error is described as "The network name cannot be found".

First of all, you need to check whether the protocol and address of the webdav server are entered correctly in the command, for example, for Yandex.Disk it should be:

https://webdav.yandex.ru

Second, check the resolution of the network name - the server must be available:

C:\Windows\System32>ping webdav.yandex.ru Pinging webdav.YANDEX.ru with 32 bytes of data: Reply from 87.250.251.53: bytes=32 time=46ms TTL=51 Reply from 87.250.251.53: bytes=32 time =35ms TTL=51 Reply from 87.250.251.53: bytes=32 time=62ms TTL=51 Reply from 87.250.251.53: bytes=32 time=38ms TTL=51 Ping statistics for 87.250.251.53: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 35ms, Maximum = 62ms, Average = 45ms

If the server is unknown or not responding, then something is clearly wrong with the Internet connection.

If the network name of the server is correct, the server pings successfully, but the connection with the correct parameters always fails with error 67, then the cause of the problem is blocking the connection from the side local network. For example, this is exactly what happens at my work, because access to Internet storage via WebDav is blocked by administrators on purpose, probably to prevent information from being leaked to the side. To make sure that this is the reason, you need to try connecting with exactly the same parameters, but from another network, preferably from your home, because operators usually do not block WebDAV communications. If the check confirmed that local admins are blocking the connection, then the problem can only be solved through them.

Error 1244 - User not logged in

The full text of the error is: "The requested operation was not performed because the user is not logged in."
This error means that the server did not receive the correct username and password. The reasons can be different, like entering the wrong name or password, or entering them in the wrong place in the command.

So with this error, I check that the password is entered correctly and is between the server address and the /user parameter.

Difficulties may also arise if the password contains special characters that have special meaning in command cmd / bat files, because this part of the string can be interpreted incorrectly. To check this, you can try to temporarily specify an asterisk instead of a password, then the program will ask for a password after launch. If the password-on-demand connection works, then you need to check the password for invalid characters. For example, one of my passwords contained the ampersand character ‘&’, and this led to error 1244. We managed to get around the error by enclosing the password in quotes. But if the password contains a quote character, then most likely it will not be possible to get around this - it is better to change the password by excluding quotes from it.

Actions with storage in a batch file

How to check that the storage is connected

Checking that the connection is established and the server is available may be required in batch files. It can be done with the IF EXIST command.

For example, the cmd/bat file for connecting WebDAV checks if the disk is already connected, then immediately exits:

If exist Y:\* echo Already connected. & exit / b 0

Or the cmd/bat backup file checks that the network drive is available before uploading:

If not exist Y:\* echo Not connected. & exit /b 1

Copying Files via WebDAV

Due to client-side buffering in standard COPY or Explorer, data can be lost, so it is recommended to use XCOPY with buffering disabled and with size control.

Xcopy *.zip y:\backup /Y /Z /V /J

Automatic mapping of a network drive

The ability to automatically map a network drive when the computer boots is actually already there and is enabled by the /persistent:yes parameter (see above).

The disadvantage of this solution is that when the computer boots, only one attempt is made to mount the drive. If at that moment there was no network connection or the server was temporarily unavailable, the disk will remain unconnected.

The same problem occurs if you insert only the connection command into startup:

Net use Y: https://webdav.yandex.ru password/user: email_address/persistent:yes

Mapping a network drive with check and retry

To make a more reliable solution, I use a cmd/bat file with checking the result and trying again:

@echo off if exist y:\* echo Already connected. & exit /b 0:connect net use y: https://webdav.yandex.ru password /user: [email protected] if errorlevel 1 ping 127.0.0.1 -n 60 > nul & goto connect

This batch file can be run manually or via autoload.

In order not to interfere with black bat window file, you can hide it by running it through a script, see below.

It is assumed that the backups are already added to a specific folder. In the example below, this is the folder backup located at the root of the server.

After installing and configuring Yandex Disk.

Across command line create a directory on the server my_scripts and script file backup_webdav.sh, which will move backups to Yandex Disk:

cd /
sudo mkdir my_scripts
nano /my_scripts/backup_webdav.sh

Paste the contents of the script:

# Mount Yandex Disk
#mv /backup/ /mnt/yandex
cp -r /backup/* /mnt/yandex
# Disable Yandex Disk
umount /mnt/yandex

where the -r key means copying including folders.

If desired, you can move the entire folder, to do this, uncomment the move command, and comment out the copy command.

# Mount Yandex Disk
mount -t davfs https://webdav.yandex.ru /mnt/yandex/
mv /backup/ /mnt/yandex
#cp -r /backup/* /mnt/yandex
# Disable Yandex Disk
umount /mnt/yandex

From a folder /backup/ the data will be copied to the Yandex Disk folder, which is connected along the path /mnt/yandex.

Running the script manually:

sh /my_scripts/backup_webdav.sh

or if it doesn't work, like this:

cd /my_scripts
sh backup_webdav.sh

You can add a script to CRON jobs and assign a schedule.

Add jobs to CRON

Opening the CRON file

nano /etc/crontab

Adding data:

# Backup to Yandex Disk
# daily at 2:00
00 2 * * * root /my_scripts/backup_webdav.sh >/dev/null 2>&1

Permissions must be set on the backup_webdav.sh file chmod +x, otherwise it won't run via CRON. To do this, through the command line, enter:

cd /my_scripts/
chmod +x backup_webdav.sh

Now every day at 2 am, backups created third party programs, will be moved to Yandex Disk.

Backing up scripts

You can also for the future by doing for them backup to the root directory of the site.

You can not make a script at all in the root folder of the server, but immediately make it in the root of the site and hook it through CRON. Then the script can be created through an FTP client, and the console is only needed to edit the cron file. But in this case backup according to the schedule, it may not work, some settings for CRON will not be enough.

Liked the article? Share with friends!
Was this article helpful?
Yes
Not
Thanks for your feedback!
Something went wrong and your vote was not counted.
Thanks. Your message has been sent
Did you find an error in the text?
Select it, click Ctrl+Enter and we'll fix it!