2

I can acces to a NAS with ubuntu file browser (path : //NAS/UBUNTU) with a login/pwd.
How can I access it with the terminal ?
"cd //NAS/UBUNTU" doesn't work.

Thanks

/dev/sda6 on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,nodev,noexec,nosuid) sysfs on /sys type sysfs (rw,nodev,noexec,nosuid) none on /sys/fs/cgroup type tmpfs (rw,uid=0,gid=0,mode=0755,size=1024) none on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) udev on /dev type devtmpfs (rw,mode=0755) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755) none on /run/lock type tmpfs (rw,nodev,noexec,nosuid,size=5242880) none on /run/shm type tmpfs (rw,nosuid,nodev) none on /run/user type tmpfs (rw,nodev,noexec,nosuid,size=104857600,mode=0755) none on /sys/fs/pstore type pstore (rw) cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,relatime,cpuset) cgroup on /sys/fs/cgroup/cpu type cgroup (rw,relatime,cpu) cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,relatime,cpuacct) cgroup on /sys/fs/cgroup/memory type cgroup (rw,relatime,memory,release_agent=/run/cgmanager/agents/cgm-release-agent.memory) cgroup on /sys/fs/cgroup/devices type cgroup (rw,relatime,devices,release_agent=/run/cgmanager/agents/cgm-release-agent.devices) cgroup on /sys/fs/cgroup/freezer type cgroup (rw,relatime,freezer,release_agent=/run/cgmanager/agents/cgm-release-agent.freezer) cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,relatime,net_cls,release_agent=/run/cgmanager/agents/cgm-release-agent.net_cls) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nodev,noexec,nosuid) systemd on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,noexec,nodev,none,name=systemd) gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=thomas)

3 Answers3

2

You could use samba client which is installed in Ubuntu by default to access on Terminal. Connecting from the command line is similar to a ftp connection.

List public SMB shares with:

smbclient -L //server -U user

Connect to a SMB share with:

smbclient //server/share -U user

And then enter the password.

You can connect directly with:

smbclient //server/share -U user%password

Your password will show on the screen (less secure).

Once connected, you will get a prompt that looks like this :

smb: \>

Type help at the prompt for a list of available commands.

Tung Tran
  • 3,945
1

If you intend to access a samba share, you can use the mount command to see where the share was mounted and then accessed with the terminal. The mount will likely type "cifs". So, if you use the mount command you will see something like:

//NAS/UBUNTU on <mount point> type cifs (<options>)

so you can do a

cd <mount point>

if you want you can add to /etc/fstab an entry like this:

//NAS/UBUNTU <mount point> cifs username=<username>,password=<password> 0 0

so your share will mounted at every boot

LilloX
  • 1,997
  • 12
  • 16
  • if i try your first command, i am getting a //NAS/UBUNTU unknown file or folder. It's surprising because the file browser has succeeded in mounting it... – user1260928 Dec 07 '15 at 09:03
  • Sorry, maybe I was not clear... You have to do: mount and you will see a line like //NAS/UBUNTU on <mount point> type cifs (<options>) then you can do cd <mount point> You have to substitute with the directory show with mount command – LilloX Dec 07 '15 at 09:10
  • Ok. I don't see any line like //NAS/UBUNTU. I don't understand why. – user1260928 Dec 07 '15 at 09:15
  • Can you edit your question adding the output of the mount command? – LilloX Dec 07 '15 at 09:16
  • ok, I have done it – user1260928 Dec 07 '15 at 09:24
  • Ok, I see that you are using a new release of ununtu, maybe 15.x. The newest releases uses the path /run/user//gvfs to mount in the userspace. So you can find the mount point of your share under that path. take a look: http://askubuntu.com/questions/61196/why-do-my-gvfs-mounts-not-show-up-under-gvfs-or-run-user-login-gvfs – LilloX Dec 07 '15 at 09:35
  • very complicated for a non expert like me.... basically I just needed to create a cron that copies a file in that NAS hourly. I wouldn't think it would be that hard. – user1260928 Dec 07 '15 at 09:53
  • the best way, for me, is to create a mount point (as root) mkdir /mnt/NAS then add to your /etc/fstab a line like: //NAS/UBUNTU /mnt/NAS cifs username=<username>,password=<password> 0 0, finally do sudo mount /mnt/NAS (just the first time, with the line added to fstab the NAS will be mounted at every boot) – LilloX Dec 07 '15 at 10:12
  • I have created a folder nas_ubuntu, then I have added this : //NAS/UBUNTU /home/thomas/nas_ubuntu cifs username=admin,password=xxxxxx 0 0 in fstab then ran : sudo mount $HOME/nas_ubuntu. I got : mount: wrong fs type, bad option, bad superblock on //NAS/UBUNTU, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount. helper program)
       In some cases useful info is found in syslog - try
       dmesg | tail or so.
    
    – user1260928 Dec 07 '15 at 10:22
0

You will need the smbclient command for this. It works mostly similar to the ftp command.

smbclient --user username //NAS/UBUNTU

will ask you for your password, then set up an interactive session for you to store and retrieve files. See the man page.

Jos
  • 29,224