How can I use the linux terminal to access another file system on a network?
SCP
When using scp, you have to have an openssh-server on the remote computer you're trying to access. You can check if it's installed with apt-cache policy openssh-server
. Then scp is used to fetch a file like this:
scp user@remote-hostname:Documents/file.txt ~/Documents/
or to send a file:
scp ~/Documents/file.txt user@remote-hostname:Documents/
which will prompt you to enter the remote-user's password. The path after the colon (:) assumes the user's home directory, which is why you can use Documents/file.txt instead of /home/user/Documents/file.txt .
NFS
NFS is the linux-only Network File System. I've never used it but you can find some instructions at https://mxlinux.org/wiki/networking/nfs ... However those instructions do not show how to setup security on the shares so that a password is necessary to access the shares.
SAMBA
Samba (SMB/CIFS) is a file server that is compatible with Gnu/Linux and Windows computers. I use samba, but I don't use it to access Windows computers so I don't know if there are any quirks in that use-case (Linux to Windows). You can find good instructions for setting up samba on a debian-based system (Debian, Ubuntu, Linux-mint, etc) at https://wiki.debian.org/SambaServerSimple:
........................................................
Install Samba Server as root or using sudo
apt-get install samba
Install Samba Client
apt-get install samba-client
And the instructions go on to configuring samba's config file (/etc/samba/smb.conf) and setting up samba passwords (which are separate from your users system-login password but the same password can be used).
........................................................
If you run apt-cache show samba
on your machine it shows information on the samba package. One sentence to note:
This package is not required for connecting to existing SMB/CIFS servers (see smbclient) or for mounting remote filesystems (see cifs-utils).
To set up a share that doesn't require entering a password, a paragraph like the one that follows can be added to your /etc/samba/smb.conf :
[sharename]
path = /path/to/share/directory
comment = short description of share
browseable = yes
guest ok = yes
read only = no
create mask = 777
To access a samba share from the file-browser on my pc's, sometimes using the 'browse network' button or menu entry doesn't work. In that case I manually have to type in the samba address into 'pathbar' by clicking in the pathbar, or if you pathbar is in a 'button' view, you can revert it to a pathname by using the keyboard shortcut Ctrl-l (lower-case L). Then type in: smb://IP-address/sharename
. For samba-shares that were set up without requiring a password, you can leave the password field empty and press the connect button.
Related videos on Youtube
Frank Patton
Updated on September 18, 2022Comments
-
Frank Patton over 1 year
Suppose there are several computers networked together. I'd like to know how to use the command prompt in linux to remotely access the file system of another computer. Is this possible?
Thanks!