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

Running php and apache on termux

This was my experience getting php and apache to run on termux apt update && apt upgrade -y apt install php-apache I was following an old blog post that used php 7 and got these errors Can't locate API module structure `php7_module' in file /data/data/com.termux/files/usr/libexec/apache2/libphp.so: undefined symbol: php7_module Cannot load /data/data/com.termux/files/usr/libexec/apache2/libphp7.so Corrected in apache config file vim $PREFIX/etc/apache2/httpd.conf LoadModule php_module /data/data/com.termux/files/usr/libexec/apache2/libphp.so Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP. Comment out mpm_worker and use mpm_prefork #LoadModule mpm_worker_module libexec/apache2/mod_mpm_worker.so LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so This still does not work as apache (httpd) was failing silently. According to Chatty LoadModule php_module ...libphp.so often fails in Termux becau...

Why is the Caribbean not a tech hub?

Why is the Caribbean not a tech hub? I saw this question online and it got me thinking. Who should be asking this question? Who should be answering this question? Do we have the data to answer this question? Besides data, what else do we need to answer this question? And when we have answers, who is going to do the work to change things? This is what my friend Chatty had to say: The question "Why is the Caribbean not a tech hub?" is really a question about history, capital, education, governance, culture, and coordination, not just technology. The Caribbean is often unfairly compared to places like Silicon Valley or Shenzhen without acknowledging that those regions benefited from massive investment, large markets, and long-term industrial planning, while Caribbean nations were shaped by colonial extraction, small fragmented markets, debt, and brain drain. We have some useful data, but not enough to fully understand the region’s digital potential, and data alone cannot answer ...