You are not logged in.
Hello everyone!
What could be the cause of the following error?
ip.of.my.phone:path/to/my/shared/folder: Permission denied
Where could I find the log for sshfs?
This error appeared when I tried to mount a folder from a prooted jail.
First, I run the following script in termux to start sshd in a prooted jail from my android phone (not rooted).
1 #!/bin/bash
2 export JailDir="$HOME/proot-fs"
3 export FTPFiles="path/to/my/shared/folder"
4 export ff="/data/data/com.termux/files"
5
6 [ -d $JailDir$ff/home ] || mkdir -p $JailDir/data/data/com.termux/files/home
7 [ -d $JailDir$ff/home/FTPFiles ] || mkdir -p $JailDir/data/data/com.termux/files/home/FTPFiles
8 [ -d $JailDir$ff/home/.ssh ] || mkdir -p $JailDir$ff/home/.ssh
9 [ -f $JailDir$ff/home/.ssh/authorized_keys ] || cp $HOME/.ssh/authorized_keys $JailDir$ff/home/.ssh/authorized_keys
10 [ -d $JailDir/home/bin ] || mkdir -p $JailDir/home/bin
11 #generating .ssh/sshd_config
12 cat > $JailDir$ff/home/.ssh/sshd_config <<-_EOF_
13 PrintMotd no
14 PasswordAuthentication yes
15 #AuthorizedKeysFile /home/.ssh/authorized_keys
16 PubkeyAcceptedKeyTypes +ssh-dss
17 Subsystem sftp /data/data/com.termux/files/usr/libexec/sftp-server
18 ListenAddress ip.of.my.phone
19 _EOF_
20 unset LD_PRELOAD
21 export LD_PRELOAD=$PREFIX/lib/libtermux-exec.so
22 ARGS="-r $JailDir"
23 #ARGS="$ARGS -b /system/bin"
24 #ARGS="$ARGS -b /system/lib64"
25 ARGS="$ARGS -b /system"
26 ARGS="$ARGS -b /etc"
27 ARGS="$ARGS -b /dev"
28 ARGS="$ARGS -b /sys"
29 ARGS="$ARGS -b /proc"
30 ARGS="$ARGS -b $PREFIX"
31 ARGS="$ARGS -b $FTPFiles"
32 case $1 in
33 off) PROGRAM="pkill sshd"
34 ;;
35 *) cat $JailDir$ff/home/.ssh/sshd_config | grep ListenAddress
36 PROGRAM="sshd"
37 ;;
38 esac
39 #PROGRAM="bash"
40 PROGRAM="sshd"
41 ARGS="$ARGS $PROGRAM"
42 proot $ARGS
Then I sshfs from my archlinux computer using the following command
sshfs ip.of.my.phone:path/to/my/shared/folder -p port
Then I get the following error.
ip.of.my.phone:path/to/my/shared/folder: Permission denied
However I can ssh into the prooted jail with the following command without any problem.
ssh ip.of.my.phome -p port
I searched around and found that permission errors usually occur when trying to read or write the remote folder after it has been successfully mounted.
what caused it to happen when mounting?
Any idea?
Thanks!
Last edited by WangYilin (2019-08-17 02:33:15)
Offline