Commit f130be05 authored by jaime's avatar jaime
Browse files

more renames corrections

parent c051d66a
......@@ -47,7 +47,7 @@ Clonar este repositorio dentro del directorio /opt
Crear ligas simbólicas a los scripts dentro de /usr/local/bin
root@debian:~# ln -s /opt/sftp_sshfs_share/sftp_sshfs_share /usr/local/bin/
root@debian:~# ln -s /opt/sftp_sshfs_share/sftp_proxy_setup /usr/local/bin/
root@debian:~# ln -s /opt/sftp_sshfs_share/wrapper_functions_sftp_sshfs_share /usr/local/bin/
root@debian:~# ln -s /opt/sftp_sshfs_share/create_systemd_sshfs_mount_point /usr/local/bin/
......
#!/bin/bash
#this script create a local sftp only user with access to sshfs mounted directories owned by other local users
#this script will create a local sftp only user with access to sshfs mounted directories owned by other local users
(( `id -u` )) && echo -e "\e[00;31mEs necesario correr este script con privilegios de root\e[00m" && exit 1
......
#!/bin/bash
#this script create a local sftp only user with access to sshfs mounted directories owned by users on a remote host
#this script will create a local sftp only user with access to a sshfs mounted directory owned by users on a remote host
(( `id -u` )) && echo -e "\e[00;31mEs necesario correr este script con privilegios de root\e[00m" && exit 1
......
#!/bin/bash
(( `id -u` )) && echo -e "\e[00;31mEs necesario correr este script con privilegios de root\e[00m" && exit 1
source wrapper_functions_sftp_sshfs_share
USER=$1
REMOTEUSER=$2
DEFAULT_DIRS="privado respaldos"
#this folder will contain other shared mount points
MASTER_SHARED_FOLDER="compartido"
SPECIAL_KEYNAME="sshfs_mount"
REMOTE_HOST="127.0.0.1"
REMOTE_SHAREDFOLDER="compartido"
DEFAULT_SFTPGROUP="sftponly"
LOCAL_SFTPGROUP="localsftp"
create_special_group $DEFAULT_SFTPGROUP $(get_next_gid);
[[ $? -ne 0 ]] && echo "error creando grupo $DEFAULT_SFTPGROUP" && exit;
create_sftp_user $USER "" $DEFAULT_SFTPGROUP
[[ $? -ne 0 ]] && echo "error creando usuario $USER" && exit 1;
HOMEDIR=$(getent passwd $USER | cut -f6 -d:)
SSHKEY=${HOMEDIR}/.ssh/${SPECIAL_KEYNAME}
#create default dirs for local user
for DIR in $DEFAULT_DIRS; do
mkdir ${HOMEDIR}/${DIR} 2> /dev/null
#must be owned by user to alow writing by user
chown $USER:$USER ${HOMEDIR}/${DIR} 2>/dev/null
done
#create master_shared_folder owned by root
mkdir ${HOMEDIR}/${MASTER_SHARED_FOLDER} 2> /dev/null
create_special_key $USER $SPECIAL_KEYNAME
[[ $? -ne 0 ]] && echo "error creando llave $SPECIAL_KEYNAME" && exit 1;
[[ -z $REMOTEUSER ]] && exit 0;
MOUNTPOINT=${HOMEDIR}/${MASTER_SHARED_FOLDER}/${REMOTEUSER}
create_special_group $LOCAL_SFTPGROUP $(get_next_gid);
[[ $? -ne 0 ]] && echo "error creando grupo $LOCAL_SFTPGROUP" && exit 1;
create_sftp_user $REMOTEUSER "-" $LOCAL_SFTPGROUP $(get_next_gid)
[[ $? -ne 0 ]] && echo "error creando user $REMOTEUSER" && exit 1;
REMOTEHOMEDIR=$(getent passwd $REMOTEUSER | cut -f6 -d:)
mkdir -p ${REMOTEHOMEDIR}/${REMOTE_SHAREDFOLDER}
chown $REMOTEUSER:$REMOTEUSER ${REMOTEHOMEDIR}/${REMOTE_SHAREDFOLDER}
cat ${SSHKEY}.pub >> ${REMOTEHOMEDIR}/.ssh/authorized_keys
create_systemd_sshfs_mount_point "${REMOTEUSER}@${REMOTE_HOST}:${REMOTE_SHAREDFOLDER}" "$MOUNTPOINT" "$USER" "$SSHKEY"
[[ $? -ne 0 ]] && echo "error creando systemd mount unit-files" && exit 1;
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment