chiark / gitweb /
Set up home structure for authorized_keys
authordeed02392 <georgehafiz@gmail.com>
Wed, 24 May 2017 19:06:23 +0000 (20:06 +0100)
committerFredrik Fornwall <fredrik@fornwall.net>
Fri, 11 Aug 2017 11:19:00 +0000 (13:19 +0200)
Since password auth is disabled by default, we depend on keys in our home dir but they're not created for us and the perms are wrong by default. This commit sets it up correctly for the user to simply add their key to the empty authorized_keys file

packages/openssh/build.sh

index 7aa80b94d54a29f47d4b25f81850bb1d784a6b42..ddd67bf3b4f7313433d1646afd3683e2d2950dfd 100755 (executable)
@@ -71,6 +71,9 @@ termux_step_post_make_install () {
 
 termux_step_create_debscripts () {
        echo "mkdir -p \$HOME/.ssh" > postinst
 
 termux_step_create_debscripts () {
        echo "mkdir -p \$HOME/.ssh" > postinst
+       echo "touch \$HOME/.ssh/authorized_keys" >> postinst
+       echo "chmod 700 \$HOME/.ssh" >> postinst
+       echo "chmod 600 \$HOME/.ssh/authorized_keys" >> postinst
        echo "" >> postinst
         echo "for a in rsa dsa ecdsa ed25519; do" >> postinst
         echo "    KEYFILE=$TERMUX_PREFIX/etc/ssh/ssh_host_\${a}_key" >> postinst
        echo "" >> postinst
         echo "for a in rsa dsa ecdsa ed25519; do" >> postinst
         echo "    KEYFILE=$TERMUX_PREFIX/etc/ssh/ssh_host_\${a}_key" >> postinst