<SOLVED>Setting up links to remote directories

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
lsemmens
Level 11
Level 11
Posts: 3951
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

<SOLVED>Setting up links to remote directories

Post by lsemmens »

See here:viewtopic.php?f=90&t=266123&p=1449627#p1449627

I have a fileserver that is running 64bit Mint 18.3 Cinnamon, as is my laptop and (nearly) all other computers on my home network. I can mount and explore all drives on the fileserver from my laptop in Nemo (provided they are mounted in the server). So far, so good. This works well enough for me.....however.....

I am attempting to "dumb down" a system for my wife and need to set Mint up so that all she need do is to click on a link and it will take her where she wants to go. So far I have been unable to find a method whereby any directories on the file server can be automatically mounted and accessed by a link on the desktop. In (cough) Windows all I needed to do was right click on a file/folder/drive and create a shortcut. I could even set the shortcut to absolute or relative addresses. How do I do this in Linux.

eg: set up a link to this address : //MediaServer/Documents which is a drive labelled "Documents (dev/sdd1) on the computer named MediaServer (IP address: 192.168.1.102) on my laptop (called "lappy" ip 192.168.1.116) File sharing on the home network has never needed passwords but If necessary I can do so, but am trying to remove a layer of complexity.

Please can someone spell out how I can do this in Linux in a simple and understandable way? I know enough of Windows to be dangerous, Linux, I do not have a clue. i.e. assume that I do not know what SUDO is or that I need a password to access Super User rights, (I've found from a lot of my reading that, often, Linux "experts" tend to forget that beginners searching for an answer have forgotten that learners may not understand that "open a terminal as root" means open the "program" called "terminal" and then type "SUDO -i" followed by your password (which will not be shown on the screen".

I tried to follow various tutorials and so far, I haven't found a method that even works on my system.
This is the result of inxi -Fxz for my laptop

Code: Select all

leigh@leigh-Lappie ~ $ inxi -Fxz
System:    Host: leigh-Lappie Kernel: 4.13.0-36-generic x86_64 (64 bit gcc: 5.4.0)
           Desktop: Cinnamon 3.6.7 (Gtk 3.18.9-1ubuntu3.3)
           Distro: Linux Mint 18.3 Sylvia
Machine:   System: TOSHIBA product: Satellite C50D-B v: PSCN4A-02G00H
           Mobo: TOSHIBA model: ZBWAE v: 1.00
           Bios: TOSHIBA v: 5.30 date: 08/26/2015
CPU:       Dual core AMD E1-6010 APU with AMD Radeon R2 Graphics (-MCP-) cache: 2048 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm) bmips: 5389
           clock speeds: max: 1350 MHz 1: 1350 MHz 2: 1000 MHz
Graphics:  Card: Advanced Micro Devices [AMD/ATI] Mullins [Radeon R2 Graphics]
           bus-ID: 00:01.0
           Display Server: X.Org 1.18.4 drivers: ati,radeon (unloaded: fbdev,vesa)
           Resolution: 1366x768@60.00hz
           GLX Renderer: AMD MULLINS (DRM 2.50.0 / 4.13.0-36-generic, LLVM 5.0.0)
           GLX Version: 3.0 Mesa 17.2.8 Direct Rendering: Yes
Audio:     Card-1 Advanced Micro Devices [AMD] FCH Azalia Controller
           driver: snd_hda_intel bus-ID: 00:14.2
           Card-2 Advanced Micro Devices [AMD/ATI] Kabini HDMI/DP Audio
           driver: snd_hda_intel bus-ID: 00:01.1
           Sound: Advanced Linux Sound Architecture v: k4.13.0-36-generic
Network:   Card-1: Realtek RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
           driver: r8169 v: 2.3LK-NAPI port: e000 bus-ID: 02:00.0
           IF: enp2s0 state: down mac: <filter>
           Card-2: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter
           driver: ath9k bus-ID: 03:00.0
           IF: wlp3s0 state: up mac: <filter>
Drives:    HDD Total Size: 531.1GB (9.0% used)
           ID-1: /dev/sda model: TOSHIBA_MQ01ABF0 size: 500.1GB
           ID-2: USB /dev/sdb model: Patriot_Memory size: 31.0GB
Partition: ID-1: / size: 127G used: 42G (35%) fs: ext4 dev: /dev/sda6
           ID-2: swap-1 size: 3.69GB used: 0.00GB (0%) fs: swap dev: /dev/sda7
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 62.2C mobo: N/A gpu: 62.0
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 200 Uptime: 35 min Memory: 1053.0/3375.9MB
           Init: systemd runlevel: 5 Gcc sys: 5.4.0
           Client: Shell (bash 4.3.481) inxi: 2.2.35
the MediaServer is not so simple

Code: Select all

System:    Host: MediaServer Kernel: 4.13.0-36-generic x86_64 (64 bit gcc: 5.4.0)
           Desktop: Cinnamon 3.6.7 (Gtk 3.18.9-1ubuntu3.3)
           Distro: Linux Mint 18.3 Sylvia
Machine:   Mobo: Gigabyte model: GA-MA770-US3
           Bios: Award v: FA date: 04/09/2009
CPU:       Quad core AMD Phenom 9650 (-MCP-) cache: 2048 KB
           flags: (lm nx sse sse2 sse3 sse4a svm) bmips: 18483
           clock speeds: max: 2300 MHz 1: 1150 MHz 2: 1150 MHz 3: 2300 MHz
           4: 1150 MHz
Graphics:  Card: NVIDIA G96 [GeForce 9400 GT] bus-ID: 01:00.0
           Display Server: X.Org 1.18.4 drivers: nouveau (unloaded: fbdev,vesa)
           Resolution: 1024x768@60.00hz, 1920x1080@50.00hz
           GLX Renderer: NV96
           GLX Version: 3.0 Mesa 17.2.8 Direct Rendering: Yes
Audio:     Card-1 Advanced Micro Devices [AMD/ATI] SBx00 Azalia (Intel HDA)
           driver: snd_hda_intel bus-ID: 00:14.2
           Card-2 C-Media Audio Adapter driver: USB Audio usb-ID: 001-011
           Sound: Advanced Linux Sound Architecture v: k4.13.0-36-generic
Network:   Card: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
           driver: r8169 v: 2.3LK-NAPI port: de00 bus-ID: 02:00.0
           IF: enp2s0 state: up speed: 100 Mbps duplex: full mac: <filter>
Drives:    HDD Total Size: 4270.9GB (42.0% used)
           ID-1: /dev/sda model: WDC_WD10EADS size: 1000.2GB
           ID-2: /dev/sdb model: WDC_WD800JD size: 80.0GB
           ID-3: /dev/sdc model: MAXTOR_STM316021 size: 160.0GB
           ID-4: /dev/sdd model: ST3120026AS size: 120.0GB
           ID-5: USB /dev/sde model: Storage_Device size: 1000.2GB
           ID-6: USB /dev/sdf model: Ext_HDD_1021 size: 1000.2GB
           ID-7: USB /dev/sdg model: Storage_Device size: 160.0GB
           ID-8: USB /dev/sdh model: 3AS size: 750.2GB
Partition: ID-1: / size: 67G used: 14G (22%) fs: ext4 dev: /dev/sdc5
           ID-2: swap-1 size: 6.44GB used: 0.00GB (0%) fs: swap dev: /dev/sdc6
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: No active sensors found. Have you configured your sensors yet? mobo: N/A gpu: 86.0
Info:      Processes: 199 Uptime: 14 min Memory: 535.3/5960.6MB
           Init: systemd runlevel: 5 Gcc sys: 5.4.0
           Client: Shell (bash 4.3.481) inxi: 2.2.35 
leigh@MediaServer ~ $ 
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Fully mint Household
Out of my mind - please leave a message
Pheeble
Level 3
Level 3
Posts: 116
Joined: Sun Jun 21, 2015 11:27 pm
Location: Brisbane, Australia

Re: Setting up links to remote directories

Post by Pheeble »

Did you have any particular network file system in mind?

Samba (Windows networking) https://en.wikipedia.org/wiki/Samba_%28software%29 This should be simple but I've occasionally had odd problems running a Samba network system.

NFS https://en.wikipedia.org/wiki/Network_File_System
See https://help.ubuntu.com/stable/servergu ... ystem.html for a simple setup. (And https://help.ubuntu.com/community/SettingUpNFSHowTo if you want more detail)

SSHFS https://en.wikipedia.org/wiki/SSHFS is more secure but a bit more involved in setting up for automatic mounting, and more still if you want to restrict the client to particular directories.

Based on past experience I'd probably go with NFS if this is just on a local network and security isn't an issue.
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Setting up links to remote directories

Post by smurphos »

If you are using Nemoshare i guess the fileserver is using Samba?

You can mount your shares automatically on the local system at boot time by adding entries to /etc/fstab

The result would be that //MediaServer/Documents would actually appear on the system as something like /mnt/MediaServer/Documents and you can create desktop shortcuts / nemo bookmarks etc as you wish to that location.

This is an example of how the line might look in fstab - here I am mounting a samba share at remote //192.168.1.3/shared_storage at /mnt/plex_server_drive on the local system. In this particular example, the share is restricted to me as a user and requires a password which is stored in the credentials=/home/steve/.smbcredentials file.

Code: Select all

# Plex Server Network Share
//192.168.1.3/shared_storage /mnt/plex_server_drive cifs uid=steve,credentials=/home/steve/.smbcredentials,iocharset=utf8,sec=ntlm,_netdev,nofail 0 0
Please take care editing fstab - a malformed line can result in booting to emergency mode - I found this out the hard way a while back. viewtopic.php?f=46&t=232214&hilit=fstab
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
lsemmens
Level 11
Level 11
Posts: 3951
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Setting up links to remote directories

Post by lsemmens »

Thank you both for taking the time to reply, I shall investigate both of your suggestions when I finish setting up the MediaServer again. I was getting reports of low disk space on the OS drive and GParted would not let me re-locate the Windows partition so I blew it all away and started again. I now have ample disk space and no option to return to Windows on that machine without a complete system reload. Once it is all set up again, I'll be back.


Meant to hit post on this last night. I'll Try again. :(
Fully mint Household
Out of my mind - please leave a message
User avatar
lsemmens
Level 11
Level 11
Posts: 3951
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Setting up links to remote directories

Post by lsemmens »

After a pile of reading, it appears that NFS is the way to go. I'm going to need a LOT of handholding on this one.
I just spent an hour setting up auto mount on my various drives which, from what i read, was unnecessary.

So, can you please spell out what I would need to do to set up my server (first) with shares to the "Documents" drive and the "Downloads" drive.

I should be able to work out the rest of the shares from that. Sorry if I seem thick, but I get confused easily (severe Brain damage from an accident) so I'll probably need more help than most.
Fully mint Household
Out of my mind - please leave a message
WharfRat

Re: Setting up links to remote directories

Post by WharfRat »

lsemmens,

You might want to look into sshfs. It requires no setup on the server end.

You can find instructions here
Pheeble
Level 3
Level 3
Posts: 116
Joined: Sun Jun 21, 2015 11:27 pm
Location: Brisbane, Australia

Re: Setting up links to remote directories

Post by Pheeble »

lsemmens wrote: Wed Mar 21, 2018 8:30 pm So, can you please spell out what I would need to do to set up my server (first) with shares to the "Documents" drive and the "Downloads" drive.
No problem.

It's been a couple of years since I set up my NFS server, but hopefully I won't go too far wrong. I use my NFS to have common home folders for each of my computers on my local network - Documents, Downloads, Music, Pictures and Videos. That way I can access the same files from anywhere in the network.

Don't be put off by the length of this post - I've tried to err on the side of more information rather than less.

NFS Server

Ok, first the server. This is the easy bit. Start by installing the NFS server package:

Code: Select all

sudo apt-get install nfs-kernel-server
That will drag in several other packages as well, just say 'Y' to let the installation proceed.

Next you need to specify which folders you want to make available for the NFS, and how they can be accessed. This information goes in the file '/etc/exports' file. That file is owned by 'root' so you'll need to edit it as an administrator.

Each line contains two parts: the path on the server to the folder you want to share, and the access parameters.

If you wanted to export the Documents folder from your account on the server, and your user name was 'lsemmens', the first part of the entry in /etc/exports would be '/home/lsemmens/Documents'.

The second part of the entry begins with a network access specification indicating which networks and/or servers can access this NFS share. If you use an asterisk, there are no restrictions. I generally restrict this to my lan ip range. My lan uses '192.168.0.xxx', so I use '192.168.0.0/24'.

After that comes a set of parentheses containing file access restrictions. If you only want people on your local network to read (not write) the files, use '(ro,sync,no_root_squash)'. If you want the files to be writeable from an NFS client, use '(rw,sync,no_root_squash)'.

So, for example, if you wanted the Documents folder to be shared for writing, the line in /etc/exports could be:

Code: Select all

home/lsemmens/Documents    192.168.0.0/24(rw,sync,no_root_squash)
Similarly, the Downloads folder could be exported by putting this line in the /etc/exports file:

Code: Select all

home/lsemmens/Downloads    192.168.0.0/24(rw,sync,no_root_squash)
I have all of my server's media files - Documents, Downloads, etc. on a single NTFS-formatted hard drive separate from the system drive, and mounted in the server at '/mnt/ntfs-media', and I simply export the whole volume, so my '/etc/exports' file contains just a single line:

Code: Select all

/mnt/ntfs-media     192.168.0.0/24(rw,sync,no_root_squash,no_subtree_check)
The 'no_subtree_check' is just a flag to tell NFS that everything in this volume is to be shared, so don't waste time checking that we're not trying to export a restricted subfolder, because there aren't any.

NFS Client

Setting up the NFS client is the more complex part of the process, depending on how you want to do it.

You'll then need to install 'nfs-common' on each client machine, and set up some way to mount the NFS share on the client. Mounting the NFS share can be done manually, automatically in /etc/fstab, or automatically using a shell script and a custom systemd service.

I eventually settled on the systemd approach because I could write a shell script that handled errors, and included a wait-and-retry loop for those times when I had a power blackout and the restarting client tried to mount the NFS share before the restarting server was ready. The 'fstab' approach couldn't handle that situation.

The server in my network has the host name 'emachine' (yes it really is an ancient Emachine computer that a friend was going to dump)

To first check that the client can find the NFS shares, in a terminal on the client run the 'showmount' utility that is installed with 'nfs-common':

Code: Select all

showmount -e emachine
Export list for emachine:
/mnt/ntfs-media 192.168.0.0/24
At the risk of swamping you with too much information, here are my NFS client mount/unmount shell scripts, systemd service and systemd timer I use to mount and unmount my server's NFS shared folder. This is definitely the most complex part. If you are happy to mount the NFS shares using a login script or /etc/fstab, that's probably a better way to go than this:

/opt/scripts/nfs_mount/mount_nfs_shares.sh:

Code: Select all

#!/bin/sh

########################################################################
#                                                                      #
#                          mount_nfs_shares.sh                         #
#                                                                      #
#             Mount all nfs shares found on specified server           #
#                                                                      #
#                Note: This script must be run as 'root'               #
#                                                                      #
########################################################################

# Check that script is being run as root
[ "$(id -u)" -ne "0" ] && { printf "This script must be run as root\n" >&2; exit 1; }

# Script exit status
status=0

# Specify the nfs server
srvr="emachine"

# The local directory in which to create mount points and mount nfs shares
# If not defined in environment, define it now
[ ! ${NFS_MOUNT_DIR+x} ] && NFS_MOUNT_DIR="/run/nfs"

# Loop parameters
n=1
max=10
delay=5

# Loop while waiting for nfs shares to become available
while :
do
    # Try to find any nfs shares on the server
    if remote_dirs="$(showmount --no-header -e "$srvr")"
    then
        remote_dirs="$(printf "%s" "$remote_dirs" | rev | cut --complement -f1 -d' ' | rev)"

        IFS="$(printf "\n\b")"

        for rdir in $remote_dirs
        do
            share="$srvr:$rdir"
            printf "Found nfs share at '%s'\n" "$share"

            # Replace (possibly sequential) space characters in the
            # remote server name and share path with single hyphens
            ldir="$(printf "%s%s" "$srvr" "$rdir" | tr -s "[:space:]" -)"

            # Specify the local mount point directory for this share
            ldir="$NFS_MOUNT_DIR/$ldir"

            # Create the local mount point directory if it doesn't exist
            if ! mkdir -p "$ldir"
            then
                printf "Failed to create local mount point directory '%s' for nfs share '%s'\n" "$ldir" "$share" >&2
                status=1
                continue
            fi

            # Check if anything is already mounted at the mount point
            if MNTD="$(findmnt --noheadings --mountpoint "$ldir" --output SOURCE)"
            then
                # Check if the same share is already mounted at the mount point
                if printf "%s" "$MNTD" | grep "$share"
                then
                    printf "The NFS share '%s' is already mounted at '%s'" "$share" "$ldir"
                    continue
                else
                    printf "Another filesystem '%s' is already mounted at '%s'" "$MNTD" "$ldir"
                    status=1
                    continue
                fi
            fi

            # Try to mount the share at the local mount point directory
            if mount -t nfs -o auto,noatime,nolock,bg,nfsvers=4,intr,tcp,actimeo=1800 "$share" "$ldir"
            then
                printf "Mounted '%s' at '%s'\n" "$share" "$ldir"
            else
                printf "Failed to mount '%s' at '%s'\n" "$share" "$ldir" >&2
                status=1
            fi
        done
        break
    else
        printf "Failed to find nfs shares on server '%s': attempt %s of %s\n" "$srvr" "$n" "$max" >&2
        if [ $n -lt $max ]
        then
            sleep $delay
            n=$((n+1))
        else
            status=1
            break
        fi
    fi
done

exit $status

/opt/scripts/nfs_mount/unmount_nfs_shares.sh:

Code: Select all

#!/bin/sh

########################################################################
#                                                                      #
#                       unmount_nfs_shares.sh                          #
#                                                                      #
#            Iterate nfs mount points, and try to unmount each         #
#                                                                      #
#                Note: This script must be run as 'root'               #
#                                                                      #
########################################################################

# Check that script is being run as root
[ "$(id -u)" -ne "0" ] && { printf "This script must be run as root\n" >&2; exit 1; }

status=0

# The local directory from which to unmount nfs shares and remove mount points
# If not defined in environment, define it now
[ ! ${NFS_MOUNT_DIR+x} ] && NFS_MOUNT_DIR="/run/nfs"

# Extract the mountpoint paths for nfs filesystem mounts in 'local_nfs_dir'
mpts="$(nfsstat -m | grep "$NFS_MOUNT_DIR" | cut -d' ' -f1)"

# Exit if no mountpoint paths were found
[ -z "$mpts" ] && { printf "No matching nfs mountpoints were found\n"; exit 0; }

# Split strings at newlines only
IFS='
'

# iterate mount point paths and try to unmount each
for pt in $mpts
do
    printf "Found nfs filesystem mounted at '%s'\n" "$pt"
    if umount "$pt"
    then
        printf "Unmounted nfs filesystem at '%s'\n" "$pt"
        # Remove the mount point directory and any empty parent directories
        rmdir -p "$pt" 2>/dev/null
    else
        printf "Failed to unmount nfs filesystem at '%s'\n" "$pt" >&2
        status=1
    fi
done

exit $status
/etc/systemd/system/mount_nfs_shares.service:

Code: Select all

[Unit]
Description=mount_nfs_shares.service : Mount nfs shares located on specified server
RequiresMountsFor=/run
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
StandardOutput=journal
StandardError=journal
SyslogIdentifier=mount_nfs_shares
RemainAfterExit=yes
Environment="NFS_MOUNT_DIR=/run/nfs"
ExecStart=/bin/sh /opt/scripts/nfs_mount/mount_nfs_shares.sh
ExecStop=/bin/sh /opt/scripts/nfs_mount/unmount_nfs_shares.sh
/etc/systemd/system/mount_nfs_shares.timer:

Code: Select all

[Unit]
Description=Run mount_nfs_shares.service at system start

[Timer]
OnBootSec=30s
RandomizedDelaySec=5

[Install]
WantedBy=timers.target
I hope this helps, and I hope I haven't forgotten anything - as I said, it's been a while since I last did this :? Give me a yell if I've forgotten anything, or if I can help further.
User avatar
lsemmens
Level 11
Level 11
Posts: 3951
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Setting up links to remote directories

Post by lsemmens »

That looks to be the ticket WarfRat however if I try the sudo sshfs command as per the linked instructions this is the result:

as you can see, I tried varying options with no luck. What am I doing wrong? I know Linux is a solid and reliable system which is why I ditched the alternative in the first place. BUT a stick of dynamite to kill a fly does not seem to be over the top in Linux :( In Windows all I would do is share the folder and create a shortcut to the mapped drive on the client. :(

Code: Select all

leigh@leigh-Lappie ~ $ sudo sshfs -o allow_other,defer_permissions root@192.168.1.102:/ /mnt/documents
fuse: unknown option `defer_permissions'

leigh@leigh-Lappie ~ $ sudo sshfs -o allow_other,default_permissions root@192.168.1.102:/ /mnt/documents
read: Connection reset by peer

leigh@leigh-Lappie ~ $ sudo sshfs -o allow_other root@192.168.1.102:/ /mnt/documents
read: Connection reset by peer
leigh@leigh-Lappie ~ $ sudo sshfs -o allow_other documents@192.168.1.102:/ /mnt/documents
read: Connection reset by peer


leigh@leigh-Lappie ~ $ sudo sshfs -o allow_other root@[192.168.1.102]/Documents: /mnt/documents
read: Connection reset by peer
leigh@leigh-Lappie ~ $ sudo sshfs -o allow_other root@192.168.1.102/Documents: /mnt/documents
read: Connection reset by peer
leigh@leigh-Lappie ~ $ sudo sshfs -o allow_other root@MediaServer/Documents: /mnt/documents
read: Connection reset by peer
leigh@leigh-Lappie ~ $ sudo sshfs -o allow_other root@MediaServer: /mnt/documents
read: Connection reset by peer
Woops! Pheeble posted as I was playing. Off to try that now :D
Fully mint Household
Out of my mind - please leave a message
Pheeble
Level 3
Level 3
Posts: 116
Joined: Sun Jun 21, 2015 11:27 pm
Location: Brisbane, Australia

Re: Setting up links to remote directories

Post by Pheeble »

lsemmens wrote: Thu Mar 22, 2018 2:58 am as you can see, I tried varying options with no luck. What am I doing wrong?
Using sshfs to login automatically requires using public key security instead of a password.

Here's the first example I found for Ubuntu: https://www.thomas-krenn.com/en/wiki/SS ... der_Ubuntu

Linux Mint doesn't have a 'root' user for logins. You have to use a real user id. The sshfs command in the terminal is of the form 'sshfs user@server:/path/to/files /path/to/mountpoint'. The mount point folder must exist and be empty at the time of mounting.

So assuming the documents folder on the server MediaServer is /home/leigh/Documents, and it has to be mounted at /mnt/documents on the client, the terminal command from the client would be:

Code: Select all

sshfs -o allow_other leigh@MediaServer:/home/leigh/Documents /mnt/documents
User avatar
lsemmens
Level 11
Level 11
Posts: 3951
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Setting up links to remote directories

Post by lsemmens »

Tried that and the result is

Code: Select all

leigh@leigh-Lappie ~ $ sshfs -o allow_other leigh@MediaServer:/media/documents /mnt/documents
fusermount: user has no write access to mountpoint /mnt/documents
leigh@leigh-Lappie ~ $ sudo -i
[sudo] password for leigh: 
leigh-Lappie ~ # sshfs -o allow_other leigh@MediaServer:/media/documents /mnt/documents
read: Connection reset by peer
If I look at the server /media/documents is owned by root and chown won't let me take ownership no matter what I try I keep getting a "missing operand after 'media/documents' my last command was sudo chown -R -H media/documents. Which means I cannot enable shares on that drive, even if I want to.

Just a reminder "documents" is a separate drive with the label documents it is NOT a folder in the file system.
Fully mint Household
Out of my mind - please leave a message
Pheeble
Level 3
Level 3
Posts: 116
Joined: Sun Jun 21, 2015 11:27 pm
Location: Brisbane, Australia

Re: Setting up links to remote directories

Post by Pheeble »

Sorry, I was just using the /home..Documents thing as an example.

So the mount point for the Documents drive is /media/documents.

The 'chown' command takes the form 'chown -R -H userid /path/to/folder' or 'chown -R -H userid:usergroup /path/to/folder' so for /media/documents it will be 'sudo chown -R -H leigh /media/documents' or 'sudo chown -R -H leigh:leigh /media/documents'.
User avatar
lsemmens
Level 11
Level 11
Posts: 3951
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Setting up links to remote directories

Post by lsemmens »

I tried on the server "sudo chown -R -H leigh:/leigh/media/documents" with the response
chown: missing operand after 'leigh:/leigh/media/documents'
Try 'chown --help' for more information
so I tried "sudo chown -R -H leigh:/media/documents" with the same response

If I run showmount on the ip address, I can see the folder is mounted on the server, but cannot find the hostname for the server, which I thought would have been the system name, but obviously not.

Code: Select all

leigh-Lappie ~ # showmount -e 192.168.1.102
Export list for 192.168.1.102:
/media/documents 192.168.0.0/24
leigh-Lappie ~ # showmount -e MediaServer
clnt_create: RPC: Unknown host
leigh-Lappie ~ # showmount -e mediaserver
clnt_create: RPC: Unknown host
leigh-Lappie ~ # showmount -e leigh
clnt_create: RPC: Unknown host
Fully mint Household
Out of my mind - please leave a message
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Setting up links to remote directories

Post by altair4 »

If I might make a suggestion. Please post the output of the following command - on the server:

Code: Select all

sudo blkid -c /dev/null -o list
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
WharfRat

Re: Setting up links to remote directories

Post by WharfRat »

lsemmens,

I'm surprised to see that you're having so many problems :?

This is how I connect sudo sshfs -o IdentityFile=~/.ssh/id_rsa,allow_other bill@192.168.1.103:/media/linuxshared ~/shared/

It might be better if you create your mount point in your home folder rather than /mnt.
Pheeble
Level 3
Level 3
Posts: 116
Joined: Sun Jun 21, 2015 11:27 pm
Location: Brisbane, Australia

Re: Setting up links to remote directories

Post by Pheeble »

lsemmens wrote: Thu Mar 22, 2018 9:33 am I tried on the server "sudo chown -R -H leigh:/leigh/media/documents" with the response
chown: missing operand after 'leigh:/leigh/media/documents'
Try 'chown --help' for more information
so I tried "sudo chown -R -H leigh:/media/documents" with the same response

If I run showmount on the ip address, I can see the folder is mounted on the server, but cannot find the hostname for the server, which I thought would have been the system name, but obviously not.

Code: Select all

leigh-Lappie ~ # showmount -e 192.168.1.102
Export list for 192.168.1.102:
/media/documents 192.168.0.0/24
leigh-Lappie ~ # showmount -e MediaServer
clnt_create: RPC: Unknown host
leigh-Lappie ~ # showmount -e mediaserver
clnt_create: RPC: Unknown host
leigh-Lappie ~ # showmount -e leigh
clnt_create: RPC: Unknown host
You're formatting the 'chown' command incorrectly. You need to specify the user id of the new owner in the command. So 'sudo chown -R -H leigh:leigh /media/documents'. That way you're changing the owner of '/media/documents' to userid 'leigh' and usergroup 'leigh'. The spaces are necessary. To check the details of a linux command, the 'man' utility (man = 'manual') is a good place to start. In a terminal type 'man chown'. That will show information about the structure of the command and possible parameters.

The server's host name will be unknown to a client on the network unless the client has been informed somehow that, for example, 'MediaServer' means '192.168.1.102'. For the moment, it's probably best to use ip addresses. You can always sort out the host name resolution later.
User avatar
lsemmens
Level 11
Level 11
Posts: 3951
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Setting up links to remote directories

Post by lsemmens »

Thanks for the heads up on Chown, Pheeble, I eventually worked that out, however it does not seem to want to do anything because there appear to be some corrupted files on the drive, I now need to find some free space somewhere to move everything off that drive and start again.

as for the blkid

Code: Select all

device           fs_type     label            mount point           UUID
-------------------------------------------------------------------------------------------------------------------------------------
/dev/sda1      ntfs          Kids             /media/kids           4C8C319C8C31818E
/dev/sdb1      ntfs          Downloads        /media/downloads      9E1CE5C11CE59495
/dev/sdc1      ext4                           /                     728f7dc33-93af-4ca0-aed3-f95ae94345bb
/dev/sdc5      swap                           [SWAP]                7474cf68-e1b5-4416-802c-de70305a8f14
/dev/sdd1      ntfs          Documents        /media/documents      F0FA28F5FA28BA2C
/dev/sde1      ntfs          video            /media/leigh/video    6CA460FCA460C9E2
/dev/sdf1      ntfs          extVid           /media/leigh/extVid   0C7A15677A154F38
/dev/sdg5      ntfs          Load - Music     (not mounted)         01D2E03A67C255570
For now I have been working on sdd1 only which is the Documents drive - see my comment at the beginning of this post.
Fully mint Household
Out of my mind - please leave a message
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Setting up links to remote directories

Post by altair4 »

You can not chown /media/documents because it's formatted in NTFS.
Post the output of this command so we can see how you mounted it - on the server:

Code: Select all

cat /etc/fstab
Side note: Just in case you have samba up and running again you might want to post the output of these as well - on the server:

Code: Select all

testparm -s

Code: Select all

net usershare info --long
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
User avatar
lsemmens
Level 11
Level 11
Posts: 3951
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Setting up links to remote directories

Post by lsemmens »

You can not chown /media/documents because it's formatted in NTFS.
Thank you!! That explains a lot. Since I posted last, I have reloaded the Server from scratch. (twice) unplugged numerous drives and transferred a heap of stuff to reduce the hardware overhead. Currently I have only two drives connected One with Linux and one formatted as EXT4 which is currently labelled as "Extra". File sharing has been set up on that machine and, so far, all is happy. As I performed the last install I documented, step by step, every process that I had to perform to get it working as I desired. When I'm certain all is well, I shall post a newbies guide.
Fully mint Household
Out of my mind - please leave a message
User avatar
lsemmens
Level 11
Level 11
Posts: 3951
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Setting up links to remote directories

Post by lsemmens »

I haven't forgotten this, am doing some major re-arrangements on the server to make paths and drives a little less complicated.

I learnt how to undelete files in linux this morning as I was transferring data from a 1TB drive to another and must have accidentally hit the <delete> button as i was putting the keyboard down (I was working on my lap) and promptly deleted most of the data that had been highlighted to copy. My stupid.... Problem fixed now and system is slowly copying files from one drive to another. (My main aim is to do away with NTFS and go entirely EXT4 for my file systems. Any BOT I'm thinking that all I need do is map my network shares on my client machine, but, so far, have not been able to find the appropriate way to do so, or am I still thinking too much M$ and not Linux?
Fully mint Household
Out of my mind - please leave a message
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Setting up links to remote directories

Post by altair4 »

Any BOT I'm thinking that all I need do is map my network shares on my client machine, but, so far, have not been able to find the appropriate way to do so, or am I still thinking too much M$ and not Linux?
A "map" in Linux is a bookmark. When you connect to the server or one of it's shares Bookmark the location: In nemo > Bookmarks > Add bookmark. Works with smb, sftp or ssh, etc ...
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Locked

Return to “Beginner Questions”