Difference between revisions of "Mounting Network Drives"

From MorphOS Library

(Ssh2FS)
(Ssh2FS)
Line 37: Line 37:
  
 
The ''SYS:MorphOS/Locale/Help/english/Ssh2FS.readme'' file contains a detailed description of all [[Shell_Commands/Ssh2FS|Ssh2FS]] options.
 
The ''SYS:MorphOS/Locale/Help/english/Ssh2FS.readme'' file contains a detailed description of all [[Shell_Commands/Ssh2FS|Ssh2FS]] 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 usage later.
 +
# 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 ===
 
=== Examples ===
Line 70: Line 78:
 
If you want to avoid entering the password always, and do more automatic mounting of shares, a public key can be generated and used for the authentication.
 
If you want to avoid entering the password always, and do more automatic mounting of shares, a public key can be generated and used for the authentication.
 
# Set a hostname for your machine in ''MorphOS Preferences -> Network -> Host and DNS'' if not already set
 
# 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 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 contents of the ''id_rsa.pub'' file to the ''~/.ssh/authorized_keys'' file on the server. There are several ways to do that, like these two (pick only one):
 +
## 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 guided 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 the 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.
 +
 
 
==== Unmounting ====
 
==== Unmounting ====
  

Revision as of 15:36, 12 November 2019

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.

A simple example ran 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'd open 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 by an 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 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 usage later.

  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 ran from the shell. Bold lines are what you type in the shell.

Mounting with the Password Prompt

This will ask a password for the "linuxuser" account, and mounts the remote server with "Linux" as a volume name. A drive icon with that name appears 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 mount your own home directory only.

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, it'll work too, as well as any URL to remote servers on 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 want to avoid entering the password always, and do more automatic mounting of shares, a public key can be generated and used for the 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 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 contents of the id_rsa.pub file to the ~/.ssh/authorized_keys file on the server. There are several ways to do that, like these two (pick only one):
    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 guided 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 the 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.

Unmounting

As told 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 to mount 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 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 the 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 certain 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 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 prettier 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

And let's try 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 the 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 like 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 would 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 to 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 storages. 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. And 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 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 it.

Read more about it here.


FTPMount

FTP sites can be mounted as part of a filesystem with the FTPMount program.

An installation tutorial is 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 face some issues when setting it up.