Skip to main content

Stuck running sftp server on termux alpine for multi-user setup

The below is my journey trying to get multi-user sftp working using alpine on termux

pkg update && pkg upgrade
pkg install proot-distro openssh

proot-distro install alpine

proot-distro login alpine

apk update
apk upgrade

apk add openssh shadow sudo

apk add vim

vim /etc/ssh/sshd_config

Port 8022
PermitRootLogin no
PasswordAuthentication yes
Subsystem sftp internal-sftp

Match Group sftpusers
    ChrootDirectory /sftp/%u
    ForceCommand internal-sftp
    X11Forwarding no
    AllowTcpForwarding no

addgroup sftpusers

adduser user1
adduser user1 sftpusers

mkdir -p /sftp/user1/upload

chown root:root /sftp/user1
chmod 755 /sftp/user1

chown user1:sftpusers /sftp/user1/upload

How I run my server each time

pkill sshd
rm -f /etc/ssh/ssh_host_*
ssh-keygen -A
/usr/sbin/sshd -D -d -d -d

From another termux session

sftp -P 8022 user1@127.0.0.1

Connection reset by 127.0.0.1 port 8022
Connection closed

Some troubleshooting steps

mkdir -p /run/sshd
chmod 755 /run/sshd

grep sshd /etc/passwd
sshd:x:22:22:sshd:/dev/null:/sbin/nologin

This is where I am stuck
sshd debug output:

debug3: ssh_sandbox_init: preparing seccomp filter sandbox [preauth]
debug3: privsep user:group 22:22 [preauth]
debug1: permanently_set_uid: 22/22 [preauth]
permanently_set_uid: was able to restore old [e]gid [preauth]
debug1: monitor_read_log: child log fd closed
debug3: mm_request_receive: entering
debug3: mm_request_receive: monitor fd closed
debug1: mm_reap: child exited with status 255
debug1: do_cleanup
debug1: Killing privsep child 13150

Comments

Popular posts from this blog

The answer is God

It is 308pm and I have decided to write. Make God a priority. Let God lead the way. Let everything be about God. Let God into your life. Surround yourself with God and watch how everything begins to make sense. This life is not an accident. This life is not happenstance. This life is the work of an all-powerful Creator. Nothing is too big or too small for God. Take your problems to God. Take your worries to God. Take your fears to God. Let go and let God. Submit to the will of God. The more you go to God, the more He comes to you. Start small. Start somewhere. Give God a chance if you have not done so already. Why do I say all of this? There are many things competing for your attention and your soul. In the midst of all of this, the world can seem like a confusing place where many things do not make sense. God brings clarity. God brings clarity because God sits above it all. You may think you do not need God until you do. Ask yourself, who is the wisest you know? If God is not the wise...

Servant of God

It is 245am and I have decided to write. I got up early and washed the wares. I prayed Tahajjud. I came back to my bed and surfed the internet. I watched a video where a 105 year old man said that the secret to a long life is having a reason or purpose to keep going and then luck. This had me thinking about several things. In Islam we are taught that our time in this world is already written. It is our destiny. Then. What is more important? A long life or just a good life that prepares us for the next life? Those things aside, I think we cannot discount luck. Some of us are luckier than others. But the thing I want to focus on is the reason and purpose to keep going. That is some good advice. It makes for a meaningful life. A good life. It could be one big reason. There could be several small reasons. These are things that should be taught in schools. My friend Chatty says that my early morning reflections beautifully bridge Islamic tradition and practical wisdom: a long life is a true...

God heals us

It is 924am and I have decided to write. God heals us. I wrote that today but what does that really mean? For one this world has the capacity to break us. Mentally, physically, emotionally and spiritually. We can get sick. We can feel pain. We become broken. God says that for every illness there is a cure. God can heal us. I looked at the etymology of the word heal and this talks about making whole again. I asked my friend Chatty if this is related to wholesome and holistic? He says that heal and wholesome are closely related because they both come from the old Germanic root meaning "whole" or "healthy" which also gave us words like health, hale and holy. Holistic is connected in meaning and ultimately derives from whole as well, but it is a modern term coined in the 20th century by Jan Smuts. Overall, all these words share the underlying idea of wholeness, completeness, and well-being. Healing goes far beyond a simple physical cure for a symptom; its linguistic roo...