0

My question has already been asked here. However, the solution provided there didn't work for me.

Through Ubuntu "Files" I am able to access the samba share with smb://DOMAIN;USER@IP_ADDRESS/SHARED_DIR syntax. The "Files" asks me for a password and I am able to list all the directories inside the share.

To make the same in Emacs, I first installed smbclient using sudo apt install smbclient.

Next I tried to open the shared directory through C-x C-f /smb:USER%DOMAIN@IP_ADDRESS:/SHARED_DIR/. I am using Swiper in Emacs. As soon as I enter the colon after the IP_ADDRESS Emacs asks me for a password. After I enter the password, it continues to show me text "[No match]" ahead of my text entry even if I enter /SHARED_DIR/ RET. Since nothing is matching, it asks me to confirm the entered file and instead creates an empty file in the local directory where earlier file was opened.

Through the command line, I tried to see whether smbclient is able to connect. I get something like below output for the list command. The output lists correct shares (including my SHARED_DIR) but I also see some errors towards the end which I didn't understand.

$ smbclient --list=IP_ADDRESS --user=amit_tendulkar --workgroup=IP_ADDRESS
WARNING: The "syslog" option is deprecated
Enter IP_ADDRESS\amit_tendulkar's password: 

        Sharename       Type      Comment
        ---------       ----      -------
        ADMIN$          Disk      Remote Admin
        C$              Disk      Default share
        D$              Disk      Default share
        IPC$            IPC       Remote IPC
        SHARED_DIR      Disk      
Reconnecting with SMB1 for workgroup listing.
Connection to IP_ADDRESS failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
Failed to connect with SMB1 -- no workgroup available

I am giving domain name same as IP_ADDRESS as the user is local to the Windows machine (which works through Ubuntu "Files").

Any pointers?

EDIT: I found out that the issue was with the sequence of keystrokes. Since my user on the Windows host was local one, the IP_ADDRESS works as a domain name (it is better to use hostname though). The sequence of commands are as follows (this is assuming swiper),

C-x C-f //

The above will take you to root dir as per swiper. Now putting all keystrokes ignoring auto-completion for the sake of clarity.

smb:USERNAME%IP_ADDRESS@IP_ADDRESS:

At this point I am prompted for a password. After entering the password, put in below text. Swiper will display [No Match] till you press TAB. Note that I am using the share D$ and have to escape $ by putting $$.

/D$$/ TAB

At this point you will start seeing directories and files in the proposed list. Select/navigate to appropriate directory or file. While selecting a file, you will be prompted for a password again. After entering the password the file should get loaded in your buffer now.

1

As you wrote, in emacs, the syntax is /smb:USER%DOMAIN@IP_ADDRESS:. Personally I would use the host name instead of IPADDRESS, but this shouldn't matter.

Important is the DOMAIN part. This must be either the Windows domain, or (like in your case) the local host name. In your smbclient call you have used IPADDRESS as --workgroup argument, which is definitely wrong.

  • Thanks. The issue was related to sequence of keystrokes. I will edit the question with my found answer. I obtained the workgroup from the host which had value "WORKGROUP". This and also the host name in the --workgroup argument didn't work. I will need more research on smbclient to make it work properly through command line. – Amit Tendulkar Dec 28 '18 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.