How to cd into smb://[email protected] from terminal?

74,675

Solution 1

The reason you can't cd in that share is because cd only works on local filesystems*, you have two ways of solving your problem here:

Use smbclient to browse the share:

smbclient -U john //69.100.100.1/SHARENAME

or mount -t cifs if you want to mount the share locally, note that the mount point must exist as a folder:

sudo mount -t cifs -o user=john,iocharset=utf8,noperm //69.100.100.1/SHARENAME ~/shares/SHARENAME 

Make sure you adapt SHARENAME to match your environnement.

If your login is part of an Active Directory domain you may want to add its name to those commands, with the second one that would be:

sudo mount -t cifs -o user=YOURDOMAIN//john,iocharset=utf8,noperm //69.100.100.1/SHARENAME ~/shares/SHARENAME

* The meaning of "local" here is not straightforward, just keep in mind you can't use normal tools before you mount remote FS locally.

Solution 2

Shamelessly borrowed from https://askubuntu.com/questions/101029/how-do-i-mount-a-cifs-share

terminal command is:

sudo mount -t cifs -o username=USERNAME,password=PASSWD //192.168.1.88/shares /mnt/share

note you may need to install cifs-utils

Share:
74,675

Related videos on Youtube

John
Author by

John

We consult and build stuff out of Toronto!

Updated on September 18, 2022

Comments

  • John
    John over 1 year

    I am using ubuntu and gnome on my computer.

    When I open up File Browser, on the left hand rail, I see conveniently a folder called "Work Server". When I mouse over it, the following caption appears "smb://[email protected]". If I click on that folder, then I can see the contents of that folder. Everything is great.

    So now when I open up a terminal/shell, I type in

    cd smb://[email protected]
    

    I get an error saying the directory doesn't exist. How do I enter this directory via shell/terminal?

  • John
    John over 11 years
    am I supposed to replace USERNAME with the name of my current shell user? And SHARENAME with the directory name i want to cd into? When i tried I got the following error: Connection to [email protected] failed (Error NT_STATUS_BAD_NETWORK_NAME)
  • Vijay Prakash Desetty
    Vijay Prakash Desetty over 11 years
    yep, you have to specify an 'endpoint' ("SHARENAME") which is the name of the share you can see in your GUI file browser and adapt "USERNAME" (maybe even add your domain before that) to be able to mount the share.
  • Baumann
    Baumann about 8 years
    smbmount is deprecated and not maintained any longer. mount.cifs (mount -t cifs) should be used instead of smbmount (smbmount Linux man page)
  • Mike 'Pomax' Kamermans
    Mike 'Pomax' Kamermans over 5 years
    how does one do an anonymous access with cifs? Is it just a matter of setting user=anonymous?
  • Vijay Prakash Desetty
    Vijay Prakash Desetty about 5 years
    Just don't use 'user' at all for guest access.
  • Chameleon
    Chameleon almost 4 years
    Nice broken thing. You can have access to a samba share with PCManFM-QT on user-level, but to have access on console, you need mount on sudo level. Good job Linux. Solid solutions are drivers on OS-level and not on App-level (as PCManFM). I never understand why a user cannot mount.
  • Karsun
    Karsun almost 4 years
    where is the sudo