Using ls and cd comands on network folders
Super-new linux/terminal user here-
Is it possible to use ls and cd comands directly on directories within a public folder on a NAS, or does the share need to me mounted within the root directory structure first?
If so, how would the path look?
Solution 1:
This depend on how is the NAS set up?
Does it use windows sharing? Then you can use smbclient
to connect to the server and there you can use ls
and cd
. Connect with something like smbclient //192.168.2.10/Volume1
.
Does it use ftp? Then you can use ftp
to connect to the server and use cd
and ls
again. Connect with something like: ftp 192.168.2.10
.
Does it use sftp? Then you can use sftp
to connect to the server and use cd
and ls
again. Connect with something like: sftp [email protected]
.
And so on. So generally you don't need it to be mounted, because usually you can access the files with a client.
I expand the samba version, because you have that kind of share:
-
You need the ip of the NAS, e.g 192.168.2.10, then you type in a terminal:
smbclient -L=192.168.2.10
The server will ask for a password but because you said it is a public share you don't need one, just press ENTER. Now you are presented with the shares services on the server, e.g.:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.14a] Sharename Type Comment --------- ---- ------- Volume1 Disk IPC$ IPC IPC Service () ADMIN$ IPC IPC Service ()
As you see I have only one Disk share named
Volume1
. -
Now you type in
smbclient //192.168.2.10/Volume1
or
smbclient \\\\192.168.2.10\\Volume1
to access the
Volume1
share on the server with ip192.168.2.10
. The server again asks for a password, just press ENTER. Now you are in the client and can browse the shared volume without mounting it to your file system. You can type
help
to get the available commands, but if you are familiar withftp
than it is basically the same. You can usels
to list the directory contents, orcd
to change directory. You can exit from the client withquit
.
Using this way the share is not mounted to your file system, only the client communicates with the server. (I think this was your question.)
Solution 2:
Stumbled on this old thread and realized it is Wrong. Ubuntu 17.04, open up the file system explorer, navigate to the network directory, right-click, select "Open in Terminal". It works well.