Difference between revisions of "Mounting Network Drives"
From MorphOS Library
Line 35: | Line 35: | ||
'''Run >NIL: SmbFS WORKGROUP=workgroup USER=MorphOS_Rulez ASKPASSWORD VOLUME=Win7_share: SERVICE=//win7/sharedstuff''' | '''Run >NIL: SmbFS WORKGROUP=workgroup USER=MorphOS_Rulez ASKPASSWORD VOLUME=Win7_share: SERVICE=//win7/sharedstuff''' | ||
: [[File:NetworkDrives_SmbFS_PW.png]] | : [[File:NetworkDrives_SmbFS_PW.png]] | ||
+ | |||
+ | |||
+ | == Smb2FS == | ||
+ | While SmbFS works only with the SMB1 protocol, [[Shell_Commands/Smb2FS|Smb2FS]] works with SMB2 and SMB3 protocols. Smb2FS can be used with SmbFS's arguments, but it also supports the URL format: | ||
+ | smb://[<domain;][<username>@]<host>[:<port>]/<share>/<path> | ||
+ | |||
+ | Since MorphOS 3.18 it's possible to browse and mount SMB2/3 shares directly from Ambient, which practically obsoletes the command-line usage of Smb2FS. Here's a [https://m.youtube.com/watch?v=YKmeI2aboUc demonstration video] of the Networks browsing and mounting. | ||
+ | |||
== Ssh2FS == | == Ssh2FS == |
Revision as of 13:36, 19 May 2023
Contents
SmbFS
Windows shares, and Samba shares on other systems like Linux servers and NAS devices, can be mounted with the native SmbFS Shell command which is included with MorphOS. You shouldn't install any third party versions, because the included command is the most up-to-date and compatible version available, and it also has 64-bit I/O support.
The SYS:MorphOS/Locale/Help/english/SmbFS.txt file contains a detailed description of all SmbFS options, but in most cases you'll be fine with just few basic options.
Note that recent mainstream systems have started to drop support for older protocol versions on their default configurations, and you might need to enable the legacy support manually to get SmbFS connected to them.
For example, on Windows 10 you might need to enable SMB 1.0/CIFS File Sharing Support options from the Turn Windows Features off and On settings in the Control Panel, and on Linux server min protocol = NT1 and ntlm auth = yes lines may need to be added to the /etc/samba/smb.conf file.
A simple example run from the Shell
SmbFS WORKGROUP=workgroup USER=myusername PASSWORD=mypassword VOLUME=Win7_share: SERVICE=//win7/sharedstuff Connected '//win7/sharedstuff' to 'Win7_share:'; "Break 5" or [Ctrl-C] to stop...
The VOLUME option specifies a volume name for the mounted device. Without it the device would only be accessible with its device name and no icon would appear on the Ambient desktop. Any name you want will be fine.
The first part of the SERVICE option contains a remote file server's name as seen, for example, on the network computers list on Windows. It is followed by a share name, which would be seen if you opened a network computer on Windows. The server name is win7 and the share name is sharedstuff in this case.
The share can be unmounted by pressing CTRL C keyboard combination when started like this.
The server name should work as it is, but if the host can't be found for some reason, you could try to add it to the Hosts settings in the MorphOS preferences.
If you want to start the SmbFS command as a background process from the Shell, the S:user-network-startup file, or anywhere else, you can launch it with the Run command. The >NIL: redirect ensures that no output windows will pop up either.
Run >NIL: SmbFS WORKGROUP=workgroup USER=myusername PASSWORD=mypassword VOLUME=Win7_share: SERVICE=//win7/sharedstuff
There are several ways to unmount the share now, but the easiest is to use the Eject screenbar module or the UnMount command.
If you replace the PASSWORD option with the ASKPASSWORD option, you'll get a requester asking for the password.
Run >NIL: SmbFS WORKGROUP=workgroup USER=MorphOS_Rulez ASKPASSWORD VOLUME=Win7_share: SERVICE=//win7/sharedstuff
Smb2FS
While SmbFS works only with the SMB1 protocol, Smb2FS works with SMB2 and SMB3 protocols. Smb2FS can be used with SmbFS's arguments, but it also supports the URL format:
smb://[<domain;][<username>@]<host>[:<port>]/<share>/<path>
Since MorphOS 3.18 it's possible to browse and mount SMB2/3 shares directly from Ambient, which practically obsoletes the command-line usage of Smb2FS. Here's a demonstration video of the Networks browsing and mounting.
Ssh2FS
The built-in Ssh2FS command can be used to mount a remote SFTP share on your local MorphOS machine. Practically all remote servers you can access using a SSH2 client can also be mounted as part of the filesystem with this command.
The SYS:MorphOS/Locale/Help/english/Ssh2FS.readme file contains a detailed description of all Ssh2FS the options.
Requirements
Ssh2FS needs a home directory for the user, and that directory must be set to MorphOS Preferences -> Users -> Home Dir or provided as a Command-Line argument to Ssh2FS (HOME=path:dir/).
It is recommended to set the home directory in the MorphOS Preferences for easier use later on.
- Create a new directory somewhere. SYS:Home, for instance.
- Set this directory to MorphOS Preferences -> Users -> Home Dir and save settings. A HOME: assign is created automatically to point into this directory.
Examples
Here are some examples to run from the Shell. Bold lines are what you need to type into the Shell.
Mounting with the Password Prompt
This will ask for a password for the "linuxuser" account, and mounts the remote server with "Linux" as a volume name. A drive icon with that name will appear on the Ambient desktop.
ssh2fs linuxuser@192.168.1.4 Linux: pw Remote says: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 Host '192.168.1.4' is not known! Add host to known_hosts file ? (y/n)y Enter password: SFTP connection established.
Now you can unmount the share by pressing the CTRL C keyboard combination, by using the Eject screenbar module, or with the UnMount Shell command (UnMount Linux:).
The previous example mounted the root directory of the server, but this would only mount your own home directory.
ssh2fs linuxuser@192.168.1.4:/home/linuxuser Linux: pw Remote says: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 Enter password: SFTP connection established.
If you have mapped a hostname for your server's IP address from MorphOS Preferences -> Hosts, that will also work, as well as any URL to remote servers on the Internet. Here we have linux4 set for the LAN address 192.168.1.4.
ssh2fs linuxuser@linux4:/home/linuxuser Linux: pw Remote says: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 Enter password: SFTP connection established.
Passwordless Mounting
If you prefer to avoid entering the password, and do more automatic mounting of shares, a public key can be generated and used for authentication.
- Set a hostname for your machine in MorphOS Preferences -> Network -> Host and DNS if not already set
- Open the Shell, type SYS:Applications/RemoteShell/Files/ssh-keygen -t rsa, and press the Enter key a few times (don't set the passphrase).
- Copy the resulting files (id_rsa and id_rsa.pub) to the .ssh directory in your MorphOS home directory. For example, Copy SYS:Applications/RemoteShell/Files/conf/id_rsa#? HOME:.ssh/
- Append the contents of the id_rsa.pub file to the ~/.ssh/authorized_keys file on the server. There are several ways to do that, such as, these two (pick only one, and notice the double > character):
- Copy the file to the server, connect by an SSH client, execute cat id_rsa.pub >> ~/.ssh/authorized_keys
- Mount your own remote home directory with Ssh2FS and the password option as mentioned in the previous section, type in the MorphOS Shell: Type HOME:.ssh/id_rsa.pub >> Linux:.ssh/authorized_keys
Now you should be able to mount the server without encountering a password prompt with the pk argument:
ssh2fs linuxuser@linux4:/home/linuxuser Linux: pk Remote says: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 SFTP connection established.
Mounting as a Background Process
The previous examples required user interaction in the Shell, but if you want to start Ssh2FS mounts as a background processes, you'll have to use the RunFS command. Normally you would do that with the Run command, but that has some limitations in this case and so that's why the RunFS command is provided.
Note that you'll have to provide a path to the Ssh2FS location (C:), otherwise RunFS won't find it. In this example we'll also disable the output with the Q=QUIET argument.
runfs Q C:ssh2fs linuxuser@linux4:/home/linuxuser Linux: pk
If you want to open a new Ambient window automatically for the newly mounted share, you can use the O=OPEN argument.
runfs Q O C:ssh2fs linuxuser@linux4:/home/linuxuser Linux: pk
With the previous lines you can mount SFTP shares, for example, automatically on each boot from S:user-network-startup, or manually from the menus or keyboard shortcuts.
Unmounting
As mentioned earlier, mounted Ssh2FS shares can be unmounted in several ways.
- Use the Eject screenbar module
- Use the UnMount Shell command: UnMount VolumeName:
- Send a CTRL C signal to the Ssh2FS task, for example, by keyboard, using the Break command, or using the TaskManager utility.
NetFS Revised
NetFS Revised allows the mounting of drives between MorphOS and AmigaOS systems. It is the best alternative to share files between Amiga compatible systems, because it preserves protection bits and other Amiga-like file properties. NetFS Revised also contains a tool to access ARexx ports remotely.
Here's a step-by-step guide of how to install it on MorphOS. NOTE: There's an installer script provided with the latest version and no manual installation is required anymore. The manual installation procedure described here is also partly outdated for now.
- Copy contents of the NetFS/SYS.MorphOS/ directory to your SYS: partition
- Copy NetFS/Prefs/Env-Archive/netfs-server.config to ENVARC:
- (Optionally) Copy NetFS/Devs/DOSDrivers/ANETFS0 to SYS:Storage/DOSDrivers/ (if you want to mount a drive with a mountlist later)
- (Optionally) Copy NetFS/Help/english/NetFS.guide to HELP:english/ (to keep the documentation available)
- Add amiganetfs 2500/tcp, amiganetfs 2500/udp, and amiganetfsprobe 2501/udp lines to the ENVARC:sys/net/services file.
- Add amiganetfs stream tcp nowait root C:InetD/netfs-server and amiganetfs dgram udp wait root C:InetD/netfs-server lines to the ENVARC:sys/net/inetd.conf file. If you don't plan to use the system as a server, you may leave it commented by starting the line with the # character, but better add the line there for any future use.
- Edit the last line on the ENVARC:netfs-server.config file to your liking on the server machine. In this example we'll allow access to the Work: partition with a specified login and password.
- Reboot the machine before trying it out.
The server works automatically, and you just need to connect to it from a client machine. We can mount the server's Work: partition by running the NetMount command on the client machine. Server's IP address is 192.168.1.10 in this example.
NetMount 192.168.1.10 Work: NetFS0: LOGIN=morphos PASS=rulez mounts the remote Work: partition as a local device called NetFS0:. The local device name can be anything you want, but NetMount creates the volume name automatically by adding the address after the remote volume name.
A better solution is to add a hostname for the server IP address, if you haven't done that already, and use that instead of the numerical address. Let's remove the mount with the UnMount command and add a hostname on the Hosts settings in the MorphOS preferences.
So, let's try that again with the NetMount pb Work: NetFS0: LOGIN=morphos PASS=rulez command.
If you want to unmount the shares with the Eject screenbar module, you'll have to decide to use a certain pattern with device names you mount and add that pattern to the Eject module's settings. If you keep using device names like NetFS0, NetFS1, NetFS3, etc, you could add NetFS#[0-9] or NetFS#? or similar to the Unmount pattern.
Also if you want to have a new default icon for the previous devices, copy or create an icon named def_NetFSxdisk.info to the SYS:Prefs/Presets/Deficons/ directory. Copy SYS:Prefs/Presets/Deficons/def_SMBFSxdisk.info to SYS:Prefs/Presets/Deficons/def_NetFSxdisk.info which would then use the same icon with SmbFS and NetFS shares.
RDesktop
The RDesktop application included in MorphOS displays a remote machine's desktop on your computer, but it can also mount a local directory on the remote machine. If you're using RDesktop to control a remote machine, it's a good way to share MorphOS files with the remote machine without needing to install any other services on your MorphOS computer.
Click the Options button on the RDesktopGUI window, open the Resources tab, and select a directory on the Mounted Directories group. The directory will be shown on the remote machine when you connect to it.
Google Drive and Dropbox Handlers
The Amiga Cloud Handlers pack contains handlers to mount both Google Drive and Dropbox cloud store-types. Write support for both handlers requires a licence key.
If you want mounted devices being activated immediately, and not when first accessed, change the wanted Activate = 0 lines to Activate = 1 lines in the DEVS:Cloud/cloud.mountlist file. Also, move mount lines from the S:user-startup file to the S:user-network-startup file, or somewhere else to be mounted later when the network connection is up for sure.
A registered version of Google Drive handler can also export Google documents to RTF, ODT, HTML, PDF, ZIP, DOCX, and TXT formats. It simply asks for the desired format when copying a Google document file from a mounted volume to any other location.
NFS
There aren't any native clients or servers for Sun's NFS protocol on MorphOS, but you can still use old 68k binaries for that purpose.
Read more about it here.
FTPMount
FTP sites can be mounted as part of a filesystem with the FTPMount program.
An installation tutorial is to be found here.
Samba
There are few ports of the full Samba package, but they are quite old and usually just overkill in most cases. If SmbFS or RDesktop fills your needs, don't go for full Samba.
Other
You might find other options and protocols to mount network drives, especially from 68k binaries. For example Envoy should work on MorphOS, to some degree, but be prepared to Google around and to face up to some issues when setting it up.