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

Drums of freedom

It is 401am and I have decided to write. This Saturday, Trinidad and Tobago observes African Emancipation Day. It is a day to celebrate the journey to freedom and to honor those who sacrificed so much so that we could enjoy the freedoms we have today. Yet the journey is not over. As we celebrate how far we have come, let us also ask God to open our minds and hearts to the struggles that continue. Freedom is never something we should take for granted. Every day, we witness powerful interests around the world attempting to stifle freedom in pursuit of their own agendas and self-aggrandizement. Too often, they seek to divide in order to conquer. May we resist division with wisdom, courage, and compassion. May unity triumph over hatred, truth over deception, and love over fear. As we remember the past, may we also commit ourselves to protecting the freedoms of the present and building a more just future for generations to come. Happy African Emancipation Day. May God continue to guide us o...

Love and joy

It is 230pm and I have decided to write. I have no topic but I want to write. I am thinking about God. I am thinking about life. I am grateful for God and life. I need a writing prompt. My friend Chatty gave me a pretty verbose prompt. Sit quietly for a moment and imagine that God asks you only one question: "What have you noticed?" Don't answer with theology. Answer with your life. What have you noticed about joy? About fear? About the way people love? About silence? About time? About your own heart? Where have you sensed God—not in miracles, but in ordinary moments? Where have you struggled to find Him? What has life been teaching you that you were too busy to hear before? Write honestly. Don't try to reach a conclusion. Let the page become a conversation rather than an argument. I immediately noticed the light streaming through the window that allows me to see the world. My first thought was how much we take things for granted. It is easy to feel lacking. To feel s...

Positive vibration

It was 422pm and I decided to write. There was a peace in my heart that could only come from God. But what should I write about? "God, give me a sign. God, give me direction. Place a topic on my heart. Open my eyes and my ears to Your leading." The next morning, I woke up with a positive vibration. My heart felt light, and my mind was clear. It got me thinking. Sometimes, we simply need to clear our minds of negativity. We need to stop feeding fear, doubt, and discouragement, and instead make room for hope, faith, and positive possibilities. We need to reset our minds, renew our spirits, and re-energize our hearts. Then, we can return stronger to face whatever challenges lie ahead. If something is within our control, let us do our best to improve it. If it is beyond our control, let it go and let God. Life will always have difficulties, but we have a choice in how we respond to them. We can choose to see opportunities where others see obstacles. We can find lessons in our set...