Mounting Network Drives

From MorphOS Library

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: 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.

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.

MorphOS Preferences Hosts.png


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.

NetworkDrives SmbFS Eject.png


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

NetworkDrives SmbFS PW.png

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.

  1. Create a new directory somewhere. SYS:Home, for instance.
  2. 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.

  1. Set a hostname for your machine in MorphOS Preferences -> Network -> Host and DNS if not already set
  2. 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).
  3. 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/
  4. 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):
    1. Copy the file to the server, connect by an SSH client, execute cat id_rsa.pub >> ~/.ssh/authorized_keys
    2. 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.

  1. Copy contents of the NetFS/SYS.MorphOS/ directory to your SYS: partition
  2. Copy NetFS/Prefs/Env-Archive/netfs-server.config to ENVARC:
  3. (Optionally) Copy NetFS/Devs/DOSDrivers/ANETFS0 to SYS:Storage/DOSDrivers/ (if you want to mount a drive with a mountlist later)
  4. (Optionally) Copy NetFS/Help/english/NetFS.guide to HELP:english/ (to keep the documentation available)
  5. Add amiganetfs 2500/tcp, amiganetfs 2500/udp, and amiganetfsprobe 2501/udp lines to the ENVARC:sys/net/services file.
    NetworkDrives NetFS1.png
  6. 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.
    NetworkDrives NetFS2.png
  7. 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.
    NetworkDrives NetFS3.png
  8. 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.

NetworkDrives NetFS4.png

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.

NetworkDrives NetFS5.png

So, let's try that again with the NetMount pb Work: NetFS0: LOGIN=morphos PASS=rulez command.

NetworkDrives NetFS6.png


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.

NetworkDrives NetFS7.png NetworkDrives NetFS8.png


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.

MorphOS3 jPV Rdesktop.png RDesktop netdisk mount.png


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.

NetworkDrives GoogleDrive1.png


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.