#!/bin/bash

ssh_mount_crw_daq_su() {

 ### allow other users to use fuse mounts
 # [ -n $(cat /etc/fuse.conf | grep '#user_allow_other') ] && { sudo perl -p -i.bak -e 's/#user_allow_other/user_allow_other/' /etc/fuse.conf ; cat /etc/fuse.conf }
 
 ### check and create group 'fuse'
 # [ -z $(cat /etc/group | grep 'fuse') ] && { sudo groupadd fuse; }
 
 ### add user to group 'fuse' if one not in group
 # [ -z $(cat /etc/group | grep 'fuse' | grep $USER) ] && { sudo usermod -aG fuse $USER; }
 
 ### make directory and allow read/write into
 # [ -e /mnt/ssh ] || { sudo mkdir -p /mnt/ssh; sudo chown root:root /mnt/ssh; sudo chmod 755 /mnt/ssh; }
 # [ -e /mnt/ssh/crw-daq.su ] || { sudo mkdir -p /mnt/ssh/crw-daq.su; sudo chown root:root /mnt/ssh/crw-daq.su; sudo chmod 755 /mnt/ssh/crw-daq.su; }
 
 ### mount sshfs
 sudo sshfs -o allow_other kouriakine@crw-daq.su:/home/users/k/kouriakine/domains  /mnt/ssh/crw-daq.su;
 
 ### report
 cat /etc/mtab | grep 'ssh';
 
 ### directory
 ls /mnt/ssh/crw-daq.su;
 
};
ssh_mount_crw_daq_su $*; 