Access samba server from Ubuntu

Source: Internet
Author: User

Access samba server from Ubuntu

Users are used to accessing files and directories on the terminal. Every time you access the samba server in the lab, you need to move the mouse ~ _~, Haha, I found myself very lazy. There are many methods to access samba from a terminal in google search. The following two methods are provided: first, access the samba server using smbclient, and then directly mount the shared directory to your computer, the second type is strongly recommended.

1. Install smbclient
    sudo apt-get install smbclient
2. view all the shared directories in the directory
Smbclient-L 10.0.0.11 #10.0.0.11 is the IP address of the samba server.

Note: After you press the preceding command, press Enter when prompted to Enter the password (because anonymous access is used). The result shows all the shared directories on the specified Samba server. (We also found a secret. The original Jing folder on our server was the essence. I really admire our master brother + _ + .)

3. Connect to the shared directory
Smbclient // 10.0.0.11/Jing # Share directory after IP Address

The prompt smb :\> appears. You can start the operation below.

4. Common commands of smbclient
? Or help [command] provides help for help or a command! [Shell command] Run the SHELL command used, or ask the user to enter the SHELL prompt cd [Directory] to switch to the specified directory on the server, if not specified, then smbclient returns the current local directory LCD [Directory] to switch to the directory specified by the client; dir or ls to list files in the current directory; exit or quit to exit smbclient get file1 file2 to download file1 from the server, the file name file2 is stored on the local machine. If you do not want to rename file2, You can omit mget file1 file2 file3 filen and download multiple files from the server; the md or mkdir directory creates the rd or rmdir directory on the server and deletes the put file1 [file2] directory on the server. upload a file file1 to the server and change the name to file2 on the server; mput file1 file2 filen upload multiple files to the server
5. Mount the shared directory to the local device.
    mount -t cifs -o username=xxx,password=xxx //10.0.0.11/Jing /home/zhangchengfei/tmp

My system environment is Ubuntu15.04 and the kernel version is 3.19. The Mount mode does not support smbfs, and the latest kernel uses cifs.

[Note] in my environment, the following statements are executed in the actual environment. You do not need to specify a password, and username can be named at will:

    mount -t cifs -o username=abc //10.0.0.11/Jing /home/zhangchengfei/tmp

[End]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.