<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>glow.li: Android</title>
        <description>A blog by glow.</description>
        <link>https://glow.li/tags/android.xml</link>
        <atom:link href="https://glow.li/tags/android.xml" rel="self" type="application/rss+xml"/>
        <generator>Glow.li Builder</generator>
            <item>
        <title>Encrypt Termux filesystem with LUKS</title>
        <description>&lt;p&gt;&lt;a href="https://glow.li/media/images/big/encrypt-termux-fs-screenshot.webp?chash=Iebu8564ff" class="size-half"&gt;&lt;img src="https://glow.li/media/images/encrypt-termux-fs-screenshot.webp?chash=Iebu87aa2c" alt="Screenshot of Termux running the script in this tutorial" title="Screenshot of Termux running the script in this tutorial" class="right size-half" loading="lazy" sizes="(max-width:703px) 100vw, 750px" srcset="https://glow.li/media/images/encrypt-termux-fs-screenshot.webp?chash=Iebu87aa2c 1500w, https://glow.li/media/images/1200/encrypt-termux-fs-screenshot.webp?chash=Iebu841cbc 1200w, https://glow.li/media/images/1000/encrypt-termux-fs-screenshot.webp?chash=Iebu84a977 1000w, https://glow.li/media/images/800/encrypt-termux-fs-screenshot.webp?chash=Iebu83c651 800w, https://glow.li/media/images/700/encrypt-termux-fs-screenshot.webp?chash=Iebu88e85c 700w, https://glow.li/media/images/600/encrypt-termux-fs-screenshot.webp?chash=Iebu8f2135 600w, https://glow.li/media/images/500/encrypt-termux-fs-screenshot.webp?chash=Iebu85189b 500w, https://glow.li/media/images/400/encrypt-termux-fs-screenshot.webp?chash=Iebu8ff084 400w, https://glow.li/media/images/300/encrypt-termux-fs-screenshot.webp?chash=Iebu838b19 300w, https://glow.li/media/images/200/encrypt-termux-fs-screenshot.webp?chash=Iebu811838 200w, https://glow.li/media/images/100/encrypt-termux-fs-screenshot.webp?chash=Iebu861214 100w" &gt;&lt;/a&gt;
People sometimes store sensitive information within &lt;a href="https://termux.com"&gt;Termux&lt;/a&gt;, like SSH Keys or PGP Keys. Within Android, this is fairly secure. No other app can access the Termux storage without explicit user consent. But our phones aren't secure devices for most people. Most people have a really short pin or password (or even none at all). So if our devices get stolen or seized, this data can easily be extracted. This short tutorial will show you a way to encrypt the whole Termux filesystem, so this data cannot be extracted once the phone has turned off or the filesystem is unmounted and closed again.&lt;/p&gt;
&lt;div id="toc"&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#Procedure"&gt;Procedure&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Requirements"&gt;Requirements&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#Rooted+phone"&gt;Rooted phone&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Blank+Termux"&gt;Blank Termux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Packages"&gt;Packages&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#Create+filesystem"&gt;Create filesystem&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#Step+1%3A+Create+a+blank+image+file"&gt;Step 1: Create a blank image file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Step+2%3A+Encrypt+image+file+using+LUKS"&gt;Step 2: Encrypt image file using LUKS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Step+3%3A+Temporarily+open+image+file"&gt;Step 3: Temporarily open image file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Step+4%3A+Format+the+image+file"&gt;Step 4: Format the image file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Step+5%3A+Close+the+image+file+again"&gt;Step 5: Close the image file again&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#Entering+the+encrypted+Termux"&gt;Entering the encrypted Termux&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#Find+your+su+binary"&gt;Find your su binary&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#Restore+your+existing+installation"&gt;Restore your existing installation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Unmounting+your+filesystem"&gt;Unmounting your filesystem&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Accessing+your+unencrypted+Termux+while+in+the+encrypted+environment"&gt;Accessing your unencrypted Termux while in the encrypted environment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#Caveats"&gt;Caveats&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#Termux%3ATasker"&gt;Termux:Tasker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#SELinux"&gt;SELinux&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;h3 id="Procedure" name="Procedure"&gt;&lt;a class="hash-link" href="#Procedure"&gt;Procedure&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;We're creating a separate filesystem in an encrypted image file, which we're then mounting at &lt;code&gt;/data/data/com.termux/files&lt;/code&gt;, which contains all of Termux' data.&lt;/p&gt;
&lt;h3 id="Requirements" name="Requirements"&gt;&lt;a class="hash-link" href="#Requirements"&gt;Requirements&lt;/a&gt;&lt;/h3&gt;
&lt;h4 id="Rooted+phone" name="Rooted+phone"&gt;&lt;a class="hash-link" href="#Rooted+phone"&gt;Rooted phone&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Unfortunately, this only works with a rooted device, as you need access to cryptsetup and mount&lt;/p&gt;
&lt;h4 id="Blank+Termux" name="Blank+Termux"&gt;&lt;a class="hash-link" href="#Blank+Termux"&gt;Blank Termux&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;It is recommended to start out with a freshly installed Termux. This is the host Termux, that will only be used to mount the encrypted Termux. You can do it on an existing Termux installation, but be aware that all data that is already in your Termux installation, will not be encrypted. If you want encrypt an existing installation you need to make a backup of it now and then reset your Termux.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rsync -a /data/data/com.termux/files /data/data/com.termux/files-backup&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Make sure to delete this backup at the end.&lt;/p&gt;
&lt;p&gt;After that you can delete &lt;code&gt;/data/data/com.termux/files&lt;/code&gt; to reset your Termux (restart after doing so). Beware that this will delete all your files. Make sure you've backed them up.&lt;/p&gt;
&lt;h4 id="Packages" name="Packages"&gt;&lt;a class="hash-link" href="#Packages"&gt;Packages&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Install the root repo:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pkg install root-repo&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install required packages:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pkg install util-linux cryptsetup tsu e2fsprogs rsync&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id="Create+filesystem" name="Create+filesystem"&gt;&lt;a class="hash-link" href="#Create+filesystem"&gt;Create filesystem&lt;/a&gt;&lt;/h3&gt;
&lt;h4 id="Step+1%3A+Create+a+blank+image+file" name="Step+1%3A+Create+a+blank+image+file"&gt;&lt;a class="hash-link" href="#Step+1%3A+Create+a+blank+image+file"&gt;Step 1: Create a blank image file&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To create an encrypted filesystem you need to first create a blank '.img' file. Adjust the size to your preference. Beware that it will use up this space on your device instantly.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fallocate -l 16G /data/data/com.termux/termux-fs.img&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id="Step+2%3A+Encrypt+image+file+using+LUKS" name="Step+2%3A+Encrypt+image+file+using+LUKS"&gt;&lt;a class="hash-link" href="#Step+2%3A+Encrypt+image+file+using+LUKS"&gt;Step 2: Encrypt image file using LUKS&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Next we are encrypting this '.img' using &lt;a href="https://en.wikipedia.org/wiki/Linux_Unified_Key_Setup"&gt;LUKS&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo cryptsetup luksFormat /data/data/com.termux/termux-fs.img&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Answer the first prompt with &lt;code&gt;YES&lt;/code&gt; and then enter a passphrase twice:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
WARNING!
========
This will overwrite data on /data/data/com.termux/termux-fs.img irrevocably.

Are you sure? (Type 'yes' in capital letters): YES
Enter passphrase for /data/data/com.termux/termux-fs.img:
Verify passphrase:&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id="Step+3%3A+Temporarily+open+image+file" name="Step+3%3A+Temporarily+open+image+file"&gt;&lt;a class="hash-link" href="#Step+3%3A+Temporarily+open+image+file"&gt;Step 3: Temporarily open image file&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To format the image file we need to temporarily open it.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo cryptsetup open /data/data/com.termux/termux-fs.img termux-fs-tmp&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You will be prompted to enter your passphrase&lt;/p&gt;
&lt;h4 id="Step+4%3A+Format+the+image+file" name="Step+4%3A+Format+the+image+file"&gt;&lt;a class="hash-link" href="#Step+4%3A+Format+the+image+file"&gt;Step 4: Format the image file&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Create a ext4 filesystem inside the encrypted volume.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo mkfs.ext4 /dev/mapper/termux-fs-tmp&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id="Step+5%3A+Close+the+image+file+again" name="Step+5%3A+Close+the+image+file+again"&gt;&lt;a class="hash-link" href="#Step+5%3A+Close+the+image+file+again"&gt;Step 5: Close the image file again&lt;/a&gt;&lt;/h4&gt;
&lt;pre&gt;&lt;code&gt;sudo cryptsetup close termux-fs-tmp&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id="Entering+the+encrypted+Termux" name="Entering+the+encrypted+Termux"&gt;&lt;a class="hash-link" href="#Entering+the+encrypted+Termux"&gt;Entering the encrypted Termux&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Now that we created the encrypted disk we simply need to mount it. Since we need to do this every time we boot our device, it's best we create a script for that.
Use &lt;a href="https://glow.li/media/files/termuxmount.sh"&gt;this script&lt;/a&gt; to enter your new filesystem:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/usr/bin/env bash
u=$(whoami)
export LD_PRELOAD=
/sbin/su -c "cryptsetup luksOpen /data/data/com.termux/termux-fs.img termux-fs"
/sbin/su -c "mount /dev/mapper/termux-fs /data/data/com.termux/files"
/sbin/su -c "/system/bin/chown $u.$u /data/data/com.termux/files"&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You will be prompted your passphrase.
This will mount your filesystem to &lt;code&gt;/data/data/com.termux/files&lt;/code&gt;.
After you've run this script, exit your Termux App and open it again. The first time you do this the Termux App will reinstall your base system inside your encrypted dist.&lt;/p&gt;
&lt;p&gt;Congratulations you are now in your encrypted filesystem. You will need to run this script again after a restart.&lt;/p&gt;
&lt;h4 id="Find+your+su+binary" name="Find+your+su+binary"&gt;&lt;a class="hash-link" href="#Find+your+su+binary"&gt;Find your su binary&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Since mounting a filesystem at &lt;code&gt;/data/data/com.termux/files&lt;/code&gt; will cause all Termux command to temporarily break, we need to make sure we're not running any Termux commands in this script. Therefore you need to specify your su binary with an absolute path. In most cases this is &lt;code&gt;/sbin/su&lt;/code&gt;, so you can use the script as is. If your &lt;code&gt;su&lt;/code&gt; is somewhere else, check these paths and replace the command in the script accordingly:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/sbin/su&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/system/sbin/su&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/system/bin/su&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/system/xbin/su&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/su/bin/su&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/magisk/.core/bin/su&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="Restore+your+existing+installation" name="Restore+your+existing+installation"&gt;&lt;a class="hash-link" href="#Restore+your+existing+installation"&gt;Restore your existing installation&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you've created a backup of your existing installation (described &lt;a href="#Blank+Termux"&gt;here&lt;/a&gt;) you can restore that backup now.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rsync -a --delete /data/data/com.termux/files-backup/ /data/data/com.termux/files/&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If everything worked, remember to delete this unencrypted backup.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rm /data/data/com.termux/files-backup -rf&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id="Unmounting+your+filesystem" name="Unmounting+your+filesystem"&gt;&lt;a class="hash-link" href="#Unmounting+your+filesystem"&gt;Unmounting your filesystem&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Unmounting your encrypted Termux is a bit annoying. Since it is always in-use you need to specify (&lt;code&gt;-l&lt;/code&gt;) lazy mode.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo umount /data/data/com.termux/files -l&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After that can restart your Termux again to be in the unencrypted filesystem again. Your encrypted filesystem is still open however, so you need to close it now.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo cryptsetup close termux-fs&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If there are any processes still accessing your encrypted Termux, this will fail. You need to either find and close these processes, or restart your device.&lt;/p&gt;
&lt;h3 id="Accessing+your+unencrypted+Termux+while+in+the+encrypted+environment" name="Accessing+your+unencrypted+Termux+while+in+the+encrypted+environment"&gt;&lt;a class="hash-link" href="#Accessing+your+unencrypted+Termux+while+in+the+encrypted+environment"&gt;Accessing your unencrypted Termux while in the encrypted environment&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;It is sometimes necessary to do maintenance (updates for example) on the unencrypted Termux. Unmounting your filesystem is one possibility, but is quite annoying. You can however use &lt;code&gt;unshare&lt;/code&gt; and &lt;code&gt;chroot&lt;/code&gt; to access your unencrypted Termux while the encrypted Termux is still running. I created &lt;a href="https://glow.li/media/files/termuxhost.sh"&gt;this script&lt;/a&gt; to do that:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/usr/bin/env bash
OPTIND=1
UNSHARED=false
while getopts ":U" opt; do
    case "$opt" in
        U)
            UNSHARED=true
            ;;
        *) ;;

    esac
done

shift $((OPTIND - 1))
if [ ! "$UNSHARED" == "true" ]; then
    user="$(whoami)"
    vars=""
    vars+=" HOME=$HOME"
    vars+=" PATH=$PREFIX/bin"
    vars+=" PREFIX=$PREFIX"
    vars+=" TMPDIR=$TMPDIR"
    vars+=" SHELL=$PREFIX/bin/login"
    vars+=" exec $PREFIX/bin/login"
    args=""
    if [ -n "$1" ]; then
        args="-c '$@'"
    fi
    $PREFIX/bin/sudo unshare -m $0 -U "$user" "$HOME" "$vars $args"
else
    mount --bind /data/data/com.termux /data/data/com.termux
    user="$1"
    user_home="$2"
    vars="$3"
    cd $user_home
    groups=${user},inet,everybody,${user}_cache,all_$(echo $user | cut -d "_" -f 2)
    exec chroot --skip-chdir --userspec=$user:$user --groups=$groups / sh -c "$vars"
fi&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Running this will drop you inside your unencrypted Termux. Since we used &lt;code&gt;unshare&lt;/code&gt; this only applies to this process. Other sessions remain unaffected. To return to your encrypted Termux simply exit this process.&lt;/p&gt;
&lt;h3 id="Caveats" name="Caveats"&gt;&lt;a class="hash-link" href="#Caveats"&gt;Caveats&lt;/a&gt;&lt;/h3&gt;
&lt;h4 id="Termux%3ATasker" name="Termux%3ATasker"&gt;&lt;a class="hash-link" href="#Termux%3ATasker"&gt;Termux:Tasker&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If you install the Termux:Tasker add-on, Tasker will not be able to execute the tasks in &lt;code&gt;~/.termux/tasker&lt;/code&gt;, because it checks your for these files in your unencrypted Termux. If you want to use this functionality you need to create blank executable files in your unencrypted Termux with the same name as the ones in your encrypted Termux. It will actually execute the scripts in your encrypted environment.&lt;/p&gt;
&lt;p&gt;I think this is a really interesting bug. I wrote a detailed bug report here: &lt;a href="https://github.com/termux/termux-tasker/issues/45"&gt;https://github.com/termux/termux-tasker/issues/45&lt;/a&gt;&lt;/p&gt;
&lt;h4 id="SELinux" name="SELinux"&gt;&lt;a class="hash-link" href="#SELinux"&gt;SELinux&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;I've run into issues using SELinux. It may be necessary to run this command after mounting:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/sbin/su -c "/system/bin/restorecon -R /data/data/com.termux/files"&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you run into continuing issues, add this to your mounting script (edit the path to &lt;code&gt;su&lt;/code&gt; as described &lt;a href="#Find+your+su+binary"&gt;here&lt;/a&gt;)&lt;/p&gt;</description>
    <pubDate>Mon, 10 May 2021 00:00:00 +0000</pubDate>
    <link>https://glow.li/posts/encrypt-termux-fs/</link>
    <guid isPermaLink="false">1620604800</guid>
</item>

<item>
        <title>Android notifications for Profanity in Termux</title>
        <description>&lt;p&gt;&lt;img src="https://glow.li/media/images/profanity-termux-notification.webp?chash=Iebu81e145" alt="Screenshot" title="Screenshot" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/profanity-termux-notification.webp?chash=Iebu81e145 1500w, https://glow.li/media/images/1200/profanity-termux-notification.webp?chash=Iebu82f6d5 1200w, https://glow.li/media/images/1000/profanity-termux-notification.webp?chash=Iebu8aeeae 1000w, https://glow.li/media/images/800/profanity-termux-notification.webp?chash=Iebu81a184 800w, https://glow.li/media/images/700/profanity-termux-notification.webp?chash=Iebu8cf5e5 700w, https://glow.li/media/images/600/profanity-termux-notification.webp?chash=Iebu8007ba 600w, https://glow.li/media/images/500/profanity-termux-notification.webp?chash=Iebu82f9ee 500w, https://glow.li/media/images/400/profanity-termux-notification.webp?chash=Iebu8e6c57 400w, https://glow.li/media/images/300/profanity-termux-notification.webp?chash=Iebu87d2e7 300w, https://glow.li/media/images/200/profanity-termux-notification.webp?chash=Iebu889b30 200w, https://glow.li/media/images/100/profanity-termux-notification.webp?chash=Iebu84d381 100w" &gt;
Just &lt;a href="https://glow.li/posts/using-pixel-fonts-in-a-browser-without-font-smoothing/"&gt;like with weechat&lt;/a&gt; you can now receive Android notifications on &lt;a href="https://termux.com"&gt;Termux&lt;/a&gt; when you receive a message in &lt;a href="https://profanity-im.github.io/"&gt;Profanity&lt;/a&gt;. I wrote a small plugin to achive exactly that. You can download it from &lt;a href="https://github.com/Neo-Oli/profanity-termux-notification"&gt;GitHub&lt;/a&gt; and install it with &lt;code&gt;/plugins install ./profanity-termux-notification/termuxnotify.py&lt;/code&gt;. Read more about the installation requirements and configuration options on &lt;a href="https://github.com/Neo-Oli/profanity-termux-notification"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;</description>
    <pubDate>Thu, 10 Nov 2016 00:00:00 +0000</pubDate>
    <link>https://glow.li/posts/android-notifications-for-profanity-with-termux/</link>
    <guid isPermaLink="false">1478736000</guid>
</item>

<item>
        <title>Access Termux via USB</title>
        <description>&lt;p&gt;I've been using &lt;a href="https://glow.li/posts/run-an-ssh-server-on-your-android-with-termux/"&gt;Termux over SSH&lt;/a&gt; for quite a while now. I've always done so over WiFi. This works reasonably well at home, where I control the IP Addresses. In other networks it was more annoying, because I always had to run &lt;code&gt;ifconfig&lt;/code&gt; first, to get my IP. But the big annoyances start when you want to use it in a place that has no WiFi network available. Previously, I used an Android tablet and a keyboard. With this I set up a WiFi direct connection between my phone. It's wonky and sometimes requires to restart both devices before working again, but it works.&lt;/p&gt;
&lt;p&gt;Then I got a laptop. Installed a proper Linux on it and tried to connect to Termux. I tried setting up WiFi Direct. But after an hour or so of messing around &lt;code&gt;wpa_supplicant&lt;/code&gt; I concluded that it's just too much of a hassle. But somewhere in the GitHub issues I came across the mention of connecting to Termux via ADB. The ADB shell is bad. I didn't actually manage to launch Termux programs via the ADB shell, but I heard that it's possible. But, and this is the point of this article, you can create port forwarding via ADB. This means that you can map a local port on your computer to a port on your Android device. Then you can open the 8022 port to access Termux via SSH over USB. This is awesome, when you're on the train, in a coffee shop or otherwise in a place with wonky or nonexistent WiFi.&lt;/p&gt;
&lt;h3 id="Here+is+how+you+do+it" name="Here+is+how+you+do+it"&gt;&lt;a class="hash-link" href="#Here+is+how+you+do+it"&gt;Here is how you do it&lt;/a&gt;&lt;/h3&gt;
&lt;h4 id="1.+You+need+ADB" name="1.+You+need+ADB"&gt;&lt;a class="hash-link" href="#1.+You+need+ADB"&gt;1. You need ADB&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Most operating systems have an ADB package. On my one I was simply able to install it with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo apt install adb&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For other platforms you can check this site &lt;a href="https://www.xda-developers.com/install-adb-windows-macos-linux/"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id="2.+Create+your+port+forward" name="2.+Create+your+port+forward"&gt;&lt;a class="hash-link" href="#2.+Create+your+port+forward"&gt;2. Create your port forward&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This part is really simple as well, and that's key. I don't want to do 500 things every time I want to connect to my phone.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;adb forward tcp:8022 tcp:8022&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is really all it takes. The first instance of &lt;code&gt;tcp:8022&lt;/code&gt; is the local port you want to bind the remote port to. The second one is the port from your Android device. Because Termux' SSHD runs on port 8022 by default, this is what you want.&lt;/p&gt;
&lt;h4 id="3.+Connect+to+it" name="3.+Connect+to+it"&gt;&lt;a class="hash-link" href="#3.+Connect+to+it"&gt;3. Connect to it&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Now that your local port is bound to your Android device you can simply connect to localhost on your computer:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ssh localhost -p 8022
#This is were you put the local port
#(ie. the first one)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will connect you to your SSH Server. If you haven't set this up yet read &lt;a href="https://glow.li/posts/run-an-ssh-server-on-your-android-with-termux/"&gt;this&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You will need to run the ADB command after every restart or after you've unplugged your device. I set up an alias for myself for the following command sequence:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;adb forward tcp:8022 tcp:8022 &amp;amp;&amp;amp; adb forward tcp:8080 tcp:8080&amp;amp;&amp;amp; ssh localhost -p 8022
# This will also setup the port 8080, which is used by the httpd webserver on termux&lt;/code&gt;&lt;/pre&gt;</description>
    <pubDate>Tue, 20 Sep 2016 00:00:00 +0000</pubDate>
    <link>https://glow.li/posts/access-termux-via-usb/</link>
    <guid isPermaLink="false">1474329600</guid>
</item>

<item>
        <title>Pass variables from Termux to Tasker</title>
        <description>&lt;p&gt;I figured out that you can pass variables from Termux to a Tasker task. This example sets Android's volume to a value specified in Termux.&lt;/p&gt;
&lt;h3 id="Step+1%3A+Creating+the+script" name="Step+1%3A+Creating+the+script"&gt;&lt;a class="hash-link" href="#Step+1%3A+Creating+the+script"&gt;Step 1: Creating the script&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;volume.sh&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/data/data/com.termux/files/usr/bin/sh
#am broadcast --user 0 -a net.dinglish.tasker.[task name] -e [variable name] "[value]" &amp;gt; /dev/null
am broadcast --user 0 -a net.dinglish.tasker.volume -e volume "$1" &amp;gt; /dev/null&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id="Step+2%3A+Create+a+Tasker+profile" name="Step+2%3A+Create+a+Tasker+profile"&gt;&lt;a class="hash-link" href="#Step+2%3A+Create+a+Tasker+profile"&gt;Step 2: Create a Tasker profile&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img src="https://glow.li/media/images/TaskerVolume1.webp?chash=Iebu8e88da" alt="Screenshot" title="Screenshot" class="right size-half" loading="lazy" sizes="(max-width:703px) 100vw, 750px" srcset="https://glow.li/media/images/TaskerVolume1.webp?chash=Iebu8e88da 1500w, https://glow.li/media/images/1200/TaskerVolume1.webp?chash=Iebu8ff9f6 1200w, https://glow.li/media/images/1000/TaskerVolume1.webp?chash=Iebu8ff9f6 1000w, https://glow.li/media/images/800/TaskerVolume1.webp?chash=Iebu8ff9f6 800w, https://glow.li/media/images/700/TaskerVolume1.webp?chash=Iebu87cd63 700w, https://glow.li/media/images/600/TaskerVolume1.webp?chash=Iebu8d6862 600w, https://glow.li/media/images/500/TaskerVolume1.webp?chash=Iebu889ab5 500w, https://glow.li/media/images/400/TaskerVolume1.webp?chash=Iebu8665b2 400w, https://glow.li/media/images/300/TaskerVolume1.webp?chash=Iebu808964 300w, https://glow.li/media/images/200/TaskerVolume1.webp?chash=Iebu89ec3d 200w, https://glow.li/media/images/100/TaskerVolume1.webp?chash=Iebu8264f8 100w" &gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a new profile&lt;/li&gt;
&lt;li&gt;Choose "Event"&lt;/li&gt;
&lt;li&gt;In the "Select Event Category" dialog choose "System"-&amp;gt;"Intent Received"&lt;/li&gt;
&lt;li&gt;As Action define &lt;code&gt;net.dinglish.tasker.volume&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This profile will now be called whenever it receives the "volume" intent.&lt;/p&gt;
&lt;h3 id="Step+3%3A+Create+the+Task" name="Step+3%3A+Create+the+Task"&gt;&lt;a class="hash-link" href="#Step+3%3A+Create+the+Task"&gt;Step 3: Create the Task&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img src="https://glow.li/media/images/TaskerVolume2.webp?chash=Iebu824219" alt="Screenshot" title="Screenshot" class="right size-half" loading="lazy" sizes="(max-width:703px) 100vw, 750px" srcset="https://glow.li/media/images/TaskerVolume2.webp?chash=Iebu824219 1500w, https://glow.li/media/images/1200/TaskerVolume2.webp?chash=Iebu8c8317 1200w, https://glow.li/media/images/1000/TaskerVolume2.webp?chash=Iebu8c8317 1000w, https://glow.li/media/images/800/TaskerVolume2.webp?chash=Iebu8c8317 800w, https://glow.li/media/images/700/TaskerVolume2.webp?chash=Iebu870faa 700w, https://glow.li/media/images/600/TaskerVolume2.webp?chash=Iebu85c64d 600w, https://glow.li/media/images/500/TaskerVolume2.webp?chash=Iebu8a35f6 500w, https://glow.li/media/images/400/TaskerVolume2.webp?chash=Iebu81e763 400w, https://glow.li/media/images/300/TaskerVolume2.webp?chash=Iebu8034b8 300w, https://glow.li/media/images/200/TaskerVolume2.webp?chash=Iebu801974 200w, https://glow.li/media/images/100/TaskerVolume2.webp?chash=Iebu860c7e 100w" &gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Tap "New Task" and give it a name&lt;/li&gt;
&lt;li&gt;Tap + to add a new Action&lt;/li&gt;
&lt;li&gt;Choose "Audio"-&amp;gt;"Media Volume"&lt;/li&gt;
&lt;li&gt;Under "Level" tap the icon with the crossing arrows to switch to text mode.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;%volume&lt;/code&gt; as a value&lt;/li&gt;
&lt;li&gt;You need to exit Tasker for the changes to take effect.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="Step+4%3A+Run+the+script" name="Step+4%3A+Run+the+script"&gt;&lt;a class="hash-link" href="#Step+4%3A+Run+the+script"&gt;Step 4: Run the script&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can now run the script. It will send an intent to Tasker. It will put the first argument as new volume, which has to be an integer from 0-15.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;./volume.sh 4&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is only a simple example of what you can do with variables. Let me know what you come up with.&lt;/p&gt;</description>
    <pubDate>Sun, 03 Apr 2016 00:00:00 +0000</pubDate>
    <link>https://glow.li/posts/pass-variables-from-termux-to-tasker/</link>
    <guid isPermaLink="false">1459641600</guid>
</item>

<item>
        <title>Display output of a bash script on a widget</title>
        <description>&lt;p&gt;&lt;a href="https://glow.li/media/images/big/termuxwidget1-big.webp?chash=Iebu876e0f"&gt;&lt;img src="https://glow.li/media/images/termuxwidget1.webp?chash=Iebu832750" alt="Screenshot" title="Screenshot" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/termuxwidget1.webp?chash=Iebu832750 1500w, https://glow.li/media/images/1200/termuxwidget1.webp?chash=Iebu8faa7b 1200w, https://glow.li/media/images/1000/termuxwidget1.webp?chash=Iebu8faa7b 1000w, https://glow.li/media/images/800/termuxwidget1.webp?chash=Iebu8faa7b 800w, https://glow.li/media/images/700/termuxwidget1.webp?chash=Iebu8faa7b 700w, https://glow.li/media/images/600/termuxwidget1.webp?chash=Iebu8faa7b 600w, https://glow.li/media/images/500/termuxwidget1.webp?chash=Iebu8faa7b 500w, https://glow.li/media/images/400/termuxwidget1.webp?chash=Iebu855039 400w, https://glow.li/media/images/300/termuxwidget1.webp?chash=Iebu82a7ab 300w, https://glow.li/media/images/200/termuxwidget1.webp?chash=Iebu8f0603 200w, https://glow.li/media/images/100/termuxwidget1.webp?chash=Iebu81bea0 100w" &gt;&lt;/a&gt;
I managed to build a bridge between &lt;a href="https://termux.com/"&gt;Termux&lt;/a&gt; and &lt;a href="https://play.google.com/store/apps/details?id=de.devmil.minimaltext"&gt;Minimalistic Text&lt;/a&gt; using &lt;a href="https://tasker.joaoapps.com/"&gt;Tasker&lt;/a&gt;. I use it to display the last 20 lines of the &lt;a href="https://gitter.im/termux/termux"&gt;#termux irc channel&lt;/a&gt; as you can see in the picture.
I've done it without having Tasker check a file every two minutes. The Task is directly called from the script.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;This tutorial is not Termux specific and should work with any terminal emulator&lt;/em&gt;&lt;/p&gt;
&lt;h3 id="Step+1%3A+Creating+the+script" name="Step+1%3A+Creating+the+script"&gt;&lt;a class="hash-link" href="#Step+1%3A+Creating+the+script"&gt;Step 1: Creating the script&lt;/a&gt;&lt;/h3&gt;
&lt;!-- more --&gt;
&lt;p&gt;All you have to do is write your output to a file in &lt;code&gt;/sdcard/&lt;/code&gt;. In this example I am grabbing the last 20 lines of log of the &lt;a href="https://gitter.im/termux/termux"&gt;#termux irc channel&lt;/a&gt; from my server.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;while true; do
  # You can basically add your own commands here. They just have to write
  # their output to `/sdcard/widget`

  # For maximum battery and bandwidth efficiency tail and cut are
  # executed on the server
  # the cut command removes the timestamps
  #
  # for this to work you need to have placed your public key on the server.
  # Otherwise you will need to enter your password every two minutes
  ssh user@example.com "cat ~/.weechat/logs/irc.freenode.#termux.weechatlog |tail -n 20 | cut -c 21-"&amp;gt;/sdcard/widget

  # This sends an Intent. This is how we'll call the Tasker task which
  # updates the widget. "net.dinglish.tasker" has to be there every
  # time for tasker to receive the intent. The last part is the name
  # of the intent which you can change if you want more than one.
  # This normally produces a bit of useless output. I am removing #
  #that with `&amp;gt;/dev/null`
  am broadcast -a net.dinglish.tasker.updatewidget --user 0 &amp;gt;/dev/null

  # sleep for 120 seconds. How often it should update the widget.
  sleep 120
done&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you run this it will download the last 20 lines of the log from a server, paste it into &lt;code&gt;/sdcard/widget&lt;/code&gt; and call Tasker with an Intent.&lt;/p&gt;
&lt;p&gt;You should also create the file &lt;code&gt;/sdcard/widget&lt;/code&gt; now. Simply do &lt;code&gt;touch /sdcard/widget&lt;/code&gt;.
&lt;img src="https://glow.li/media/images/termuxwidget2.webp?chash=Iebu85f8a9" alt="Screenshot" title="Screenshot" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/termuxwidget2.webp?chash=Iebu85f8a9 1500w, https://glow.li/media/images/1200/termuxwidget2.webp?chash=Iebu884cb8 1200w, https://glow.li/media/images/1000/termuxwidget2.webp?chash=Iebu884cb8 1000w, https://glow.li/media/images/800/termuxwidget2.webp?chash=Iebu884cb8 800w, https://glow.li/media/images/700/termuxwidget2.webp?chash=Iebu884cb8 700w, https://glow.li/media/images/600/termuxwidget2.webp?chash=Iebu884cb8 600w, https://glow.li/media/images/500/termuxwidget2.webp?chash=Iebu884cb8 500w, https://glow.li/media/images/400/termuxwidget2.webp?chash=Iebu884cb8 400w, https://glow.li/media/images/300/termuxwidget2.webp?chash=Iebu878cc7 300w, https://glow.li/media/images/200/termuxwidget2.webp?chash=Iebu837023 200w, https://glow.li/media/images/100/termuxwidget2.webp?chash=Iebu8b9674 100w" &gt;{ .right}&lt;/p&gt;
&lt;h3 id="Step+2%3A+Create+a+Tasker+profile" name="Step+2%3A+Create+a+Tasker+profile"&gt;&lt;a class="hash-link" href="#Step+2%3A+Create+a+Tasker+profile"&gt;Step 2: Create a Tasker profile&lt;/a&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Create a new profile&lt;/li&gt;
&lt;li&gt;Choose "Event"&lt;/li&gt;
&lt;li&gt;In the "Select Event Category" dialog choose "System"-&amp;gt;"Intent Received"&lt;/li&gt;
&lt;li&gt;As Action define &lt;code&gt;net.dinglish.tasker.updatewidget&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This profile will now be called whenever it recieves the "updatewidget" intent. This is a usefull way to extend the functionality of Termux. I also use it to kick of some &lt;a href="https://play.google.com/store/apps/details?id=dk.tacit.android.foldersync.lite"&gt;Foldersync&lt;/a&gt; jobs from the terminal.&lt;/p&gt;
&lt;h3 id="Step+3%3A+Create+the+Task" name="Step+3%3A+Create+the+Task"&gt;&lt;a class="hash-link" href="#Step+3%3A+Create+the+Task"&gt;Step 3: Create the Task&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img src="https://glow.li/media/images/termuxwidget3.webp?chash=Iebu846bdf" alt="Screenshot" title="Screenshot" class="right size-half" loading="lazy" sizes="(max-width:703px) 100vw, 750px" srcset="https://glow.li/media/images/termuxwidget3.webp?chash=Iebu846bdf 1500w, https://glow.li/media/images/1200/termuxwidget3.webp?chash=Iebu88f235 1200w, https://glow.li/media/images/1000/termuxwidget3.webp?chash=Iebu88f235 1000w, https://glow.li/media/images/800/termuxwidget3.webp?chash=Iebu88f235 800w, https://glow.li/media/images/700/termuxwidget3.webp?chash=Iebu88f235 700w, https://glow.li/media/images/600/termuxwidget3.webp?chash=Iebu88f235 600w, https://glow.li/media/images/500/termuxwidget3.webp?chash=Iebu88f235 500w, https://glow.li/media/images/400/termuxwidget3.webp?chash=Iebu88f235 400w, https://glow.li/media/images/300/termuxwidget3.webp?chash=Iebu8b3a95 300w, https://glow.li/media/images/200/termuxwidget3.webp?chash=Iebu82abf2 200w, https://glow.li/media/images/100/termuxwidget3.webp?chash=Iebu8db09b 100w" &gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Tap "New Task" and give it a name&lt;/li&gt;
&lt;li&gt;Tap + to add a new Action&lt;/li&gt;
&lt;li&gt;Choose "File"-&amp;gt;"Read File"&lt;/li&gt;
&lt;li&gt;Tap 🔍 and choose &lt;code&gt;/sdcard/widget&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Under "To Var" enter &lt;code&gt;%Widget&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Tap + again to add another new Action&lt;/li&gt;
&lt;li&gt;Choose "Plugin"-&amp;gt;"Minimalistic Text"-&amp;gt;"Minimalistic Text"&lt;/li&gt;
&lt;li&gt;Click the pen to edit the configuration&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;%Widget&lt;/code&gt; for both variable name and variable content&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="Step+4%3A+Configure+Minimalistic+Text" name="Step+4%3A+Configure+Minimalistic+Text"&gt;&lt;a class="hash-link" href="#Step+4%3A+Configure+Minimalistic+Text"&gt;Step 4: Configure Minimalistic Text&lt;/a&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Add a Minimalistic Text widget to your homescreen&lt;/li&gt;
&lt;li&gt;Choose any preset&lt;/li&gt;
&lt;li&gt;In the "layout" tab remove remove all rows. Now you have a blank widget&lt;/li&gt;
&lt;li&gt;Add a new element with +&lt;/li&gt;
&lt;li&gt;Switch "Misc" Tab and tick "Locale variable"&lt;/li&gt;
&lt;li&gt;Tap "OK"&lt;/li&gt;
&lt;li&gt;Click on the new "Locale variable" element&lt;/li&gt;
&lt;li&gt;In the popup enter &lt;code&gt;%Widget&lt;/code&gt; as a the "Variable name"&lt;/li&gt;
&lt;li&gt;"OK" and Save&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://glow.li/media/images/termuxwidget5.webp?chash=Iebu8c0ca4" alt="Screenshot" title="Screenshot" class="inline" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/termuxwidget5.webp?chash=Iebu8c0ca4 1500w, https://glow.li/media/images/1200/termuxwidget5.webp?chash=Iebu8ec65c 1200w, https://glow.li/media/images/1000/termuxwidget5.webp?chash=Iebu8ec65c 1000w, https://glow.li/media/images/800/termuxwidget5.webp?chash=Iebu8ec65c 800w, https://glow.li/media/images/700/termuxwidget5.webp?chash=Iebu8ec65c 700w, https://glow.li/media/images/600/termuxwidget5.webp?chash=Iebu8ec65c 600w, https://glow.li/media/images/500/termuxwidget5.webp?chash=Iebu8ec65c 500w, https://glow.li/media/images/400/termuxwidget5.webp?chash=Iebu8ec65c 400w, https://glow.li/media/images/300/termuxwidget5.webp?chash=Iebu825bae 300w, https://glow.li/media/images/200/termuxwidget5.webp?chash=Iebu80b8c7 200w, https://glow.li/media/images/100/termuxwidget5.webp?chash=Iebu830122 100w" &gt;
&lt;img src="https://glow.li/media/images/termuxwidget4.webp?chash=Iebu89d038" alt="Screenshot" title="Screenshot" class="inline" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/termuxwidget4.webp?chash=Iebu89d038 1500w, https://glow.li/media/images/1200/termuxwidget4.webp?chash=Iebu871916 1200w, https://glow.li/media/images/1000/termuxwidget4.webp?chash=Iebu871916 1000w, https://glow.li/media/images/800/termuxwidget4.webp?chash=Iebu871916 800w, https://glow.li/media/images/700/termuxwidget4.webp?chash=Iebu871916 700w, https://glow.li/media/images/600/termuxwidget4.webp?chash=Iebu871916 600w, https://glow.li/media/images/500/termuxwidget4.webp?chash=Iebu871916 500w, https://glow.li/media/images/400/termuxwidget4.webp?chash=Iebu871916 400w, https://glow.li/media/images/300/termuxwidget4.webp?chash=Iebu8a7454 300w, https://glow.li/media/images/200/termuxwidget4.webp?chash=Iebu8b822b 200w, https://glow.li/media/images/100/termuxwidget4.webp?chash=Iebu8ef637 100w" &gt;&lt;/p&gt;
&lt;h3 id="Step+5%3A+Run+the+script" name="Step+5%3A+Run+the+script"&gt;&lt;a class="hash-link" href="#Step+5%3A+Run+the+script"&gt;Step 5: Run the script&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Now you can run the script in Termux. Your widget should get updated right away.&lt;/p&gt;</description>
    <pubDate>Tue, 16 Feb 2016 00:01:00 +0000</pubDate>
    <link>https://glow.li/posts/display-output-of-a-bash-script-on-a-widget/</link>
    <guid isPermaLink="false">1455580860</guid>
</item>

<item>
        <title>Use your current location for wego in Termux</title>
        <description>&lt;p&gt;&lt;img src="https://glow.li/media/images/wego-screenshot1.webp?chash=Iebu81a704" alt="Screenshot" title="Screenshot" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/wego-screenshot1.webp?chash=Iebu81a704 1500w, https://glow.li/media/images/1200/wego-screenshot1.webp?chash=Iebu852c84 1200w, https://glow.li/media/images/1000/wego-screenshot1.webp?chash=Iebu8a1edc 1000w, https://glow.li/media/images/800/wego-screenshot1.webp?chash=Iebu8b0acd 800w, https://glow.li/media/images/700/wego-screenshot1.webp?chash=Iebu876941 700w, https://glow.li/media/images/600/wego-screenshot1.webp?chash=Iebu810616 600w, https://glow.li/media/images/500/wego-screenshot1.webp?chash=Iebu847a62 500w, https://glow.li/media/images/400/wego-screenshot1.webp?chash=Iebu88e6cf 400w, https://glow.li/media/images/300/wego-screenshot1.webp?chash=Iebu81a278 300w, https://glow.li/media/images/200/wego-screenshot1.webp?chash=Iebu84a8db 200w, https://glow.li/media/images/100/wego-screenshot1.webp?chash=Iebu8d641a 100w" &gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/schachmat/wego"&gt;Wego&lt;/a&gt; is a pretty cool weather client for the terminal.&lt;/p&gt;
&lt;p&gt;You also need &lt;a href="https://f-droid.org/en/packages/com.termux.api/"&gt;termux-api&lt;/a&gt; and the &lt;code&gt;jq&lt;/code&gt; package.&lt;/p&gt;
&lt;p&gt;Now you can run the following command to display the weather report for your current location.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;loc=$(termux-location -p network)&amp;amp;&amp;amp;wego "$(echo $loc | jq .latitude),$(echo $loc | jq .longitude)"&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id="Wego+on+termux" name="Wego+on+termux"&gt;&lt;a class="hash-link" href="#Wego+on+termux"&gt;Wego on termux&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;For wego to work you must set the WEGORC environment variable. You probably want to do this in your shells startup script.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;export WEGORC=$HOME/.wegorc&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Otherwise it installs just fine if you follow the instructions.&lt;/p&gt;
&lt;h3 id="Wttr.in" name="Wttr.in"&gt;&lt;a class="hash-link" href="#Wttr.in"&gt;Wttr.in&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you don't want to go through the hassle of installing wego, you can just use &lt;a href="https://wttr.in"&gt;wttr.in&lt;/a&gt; instead. &lt;a href="https://wttr.in"&gt;Wttr.in&lt;/a&gt; is an implementation of wego that can be called with just &lt;code&gt;curl wttr.in&lt;/code&gt; to get the current weather. If you don't want to rely on IP Geo location you can also use the same script for &lt;a href="https://wttr.in"&gt;wttr.in&lt;/a&gt; instead of wego.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;loc=$(termux-location -p network)&amp;amp;&amp;amp;curl wttr.in/$(echo $loc | jq .latitude),$(echo $loc | jq .longitude)&lt;/code&gt;&lt;/pre&gt;</description>
    <pubDate>Tue, 16 Feb 2016 00:00:00 +0000</pubDate>
    <link>https://glow.li/posts/use-your-current-location-for-wego-in-termux/</link>
    <guid isPermaLink="false">1455580800</guid>
</item>

<item>
        <title>Compile aclock on Termux</title>
        <description>&lt;p&gt;&lt;img src="https://glow.li/media/images/Screenshot-aclock.webp?chash=Iebu8cd86d" alt="Screenshot" title="Screenshot" class="right size-half" loading="lazy" sizes="(max-width:703px) 100vw, 750px" srcset="https://glow.li/media/images/Screenshot-aclock.webp?chash=Iebu8cd86d 1500w, https://glow.li/media/images/1200/Screenshot-aclock.webp?chash=Iebu848627 1200w, https://glow.li/media/images/1000/Screenshot-aclock.webp?chash=Iebu848627 1000w, https://glow.li/media/images/800/Screenshot-aclock.webp?chash=Iebu848627 800w, https://glow.li/media/images/700/Screenshot-aclock.webp?chash=Iebu848627 700w, https://glow.li/media/images/600/Screenshot-aclock.webp?chash=Iebu848627 600w, https://glow.li/media/images/500/Screenshot-aclock.webp?chash=Iebu848627 500w, https://glow.li/media/images/400/Screenshot-aclock.webp?chash=Iebu848627 400w, https://glow.li/media/images/300/Screenshot-aclock.webp?chash=Iebu8e2c42 300w, https://glow.li/media/images/200/Screenshot-aclock.webp?chash=Iebu819fe2 200w, https://glow.li/media/images/100/Screenshot-aclock.webp?chash=Iebu8a69b4 100w" &gt;
&lt;a href="https://github.com/tenox7/aclock"&gt;Aclock&lt;/a&gt; is a another clock program, but this time it's an analog clock.&lt;/p&gt;
&lt;p&gt;To compile it on &lt;a href="https://termux.dev/"&gt;Termux&lt;/a&gt; you'll need to downloaded the source.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;wget https://raw.githubusercontent.com/tenox7/aclock/master/sources/aclock-unix-curses.c&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You'll also need the &lt;code&gt;ncurses-dev&lt;/code&gt; package.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;apt install ncurses-dev&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now you simply have to compile it.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gcc aclock-unix-curses.c -o aclock -lncurses -lm&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After that you can simply run it with &lt;code&gt;./aclock&lt;/code&gt;.&lt;/p&gt;</description>
    <pubDate>Sun, 17 Jan 2016 00:00:00 +0000</pubDate>
    <link>https://glow.li/posts/compiling-aclock-on-termux/</link>
    <guid isPermaLink="false">1452988800</guid>
</item>

<item>
        <title>Compile Stag on Termux</title>
        <description>&lt;p&gt;&lt;strong&gt;This post is now obsolete. You can install &lt;code&gt;stag&lt;/code&gt; from the repository.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/seenaburns/stag"&gt;Stag&lt;/a&gt; is a cool little programm that generates a bar graph.
&lt;img src="https://glow.li/media/images/Screenshot-STAG-1.webp?chash=Iebu8f0aba" alt="Sreenshot" title="Sreenshot" class="size-half" loading="lazy" sizes="(max-width:703px) 100vw, 750px" srcset="https://glow.li/media/images/Screenshot-STAG-1.webp?chash=Iebu8f0aba 1500w, https://glow.li/media/images/1200/Screenshot-STAG-1.webp?chash=Iebu83b5a9 1200w, https://glow.li/media/images/1000/Screenshot-STAG-1.webp?chash=Iebu83b5a9 1000w, https://glow.li/media/images/800/Screenshot-STAG-1.webp?chash=Iebu83b5a9 800w, https://glow.li/media/images/700/Screenshot-STAG-1.webp?chash=Iebu83b5a9 700w, https://glow.li/media/images/600/Screenshot-STAG-1.webp?chash=Iebu83b5a9 600w, https://glow.li/media/images/500/Screenshot-STAG-1.webp?chash=Iebu83b5a9 500w, https://glow.li/media/images/400/Screenshot-STAG-1.webp?chash=Iebu83b5a9 400w, https://glow.li/media/images/300/Screenshot-STAG-1.webp?chash=Iebu898353 300w, https://glow.li/media/images/200/Screenshot-STAG-1.webp?chash=Iebu8cb80b 200w, https://glow.li/media/images/100/Screenshot-STAG-1.webp?chash=Iebu8cf1a8 100w" &gt;&lt;/p&gt;
&lt;!--more--&gt;
&lt;p&gt;&lt;img src="https://glow.li/media/images/Screenshot-STAG-2.webp?chash=Iebu8a85e5" alt="Screemshot" title="Screemshot" class="size-half" loading="lazy" sizes="(max-width:703px) 100vw, 750px" srcset="https://glow.li/media/images/Screenshot-STAG-2.webp?chash=Iebu8a85e5 1500w, https://glow.li/media/images/1200/Screenshot-STAG-2.webp?chash=Iebu83f17e 1200w, https://glow.li/media/images/1000/Screenshot-STAG-2.webp?chash=Iebu83f17e 1000w, https://glow.li/media/images/800/Screenshot-STAG-2.webp?chash=Iebu83f17e 800w, https://glow.li/media/images/700/Screenshot-STAG-2.webp?chash=Iebu83f17e 700w, https://glow.li/media/images/600/Screenshot-STAG-2.webp?chash=Iebu83f17e 600w, https://glow.li/media/images/500/Screenshot-STAG-2.webp?chash=Iebu83f17e 500w, https://glow.li/media/images/400/Screenshot-STAG-2.webp?chash=Iebu83f17e 400w, https://glow.li/media/images/300/Screenshot-STAG-2.webp?chash=Iebu85cff8 300w, https://glow.li/media/images/200/Screenshot-STAG-2.webp?chash=Iebu8c31f3 200w, https://glow.li/media/images/100/Screenshot-STAG-2.webp?chash=Iebu88ae88 100w" &gt;&lt;/p&gt;
&lt;p&gt;To compile it on &lt;a href="https://termux.dev/"&gt;Termux&lt;/a&gt; you'll need to downloaded the sources from GitHub.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;git clone https://github.com/seenaburns/stag.git&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To compile you need to install the &lt;code&gt;ncurses-dev&lt;/code&gt; package.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;apt install ncurses-dev&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Open the stag.c file and change line 90 from &lt;code&gt;char opt&lt;/code&gt; to &lt;code&gt;signed char opt&lt;/code&gt;, otherwise it will throw an error during compilation. You'll also need to make a change to the Makefile, so that the right compiler is used. Change line 1 from &lt;code&gt;CC ?= gcc&lt;/code&gt; to &lt;code&gt;cc = gcc&lt;/code&gt;.
After that you can simply use &lt;code&gt;make&lt;/code&gt; to compile and install it.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;make
make install&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="Examples" name="Examples"&gt;&lt;a class="hash-link" href="#Examples"&gt;Examples&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="CPU+usage+statisitc" name="CPU+usage+statisitc"&gt;&lt;a class="hash-link" href="#CPU+usage+statisitc"&gt;CPU usage statisitc&lt;/a&gt;&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;while true; do top -bn1 | grep "CPU:" -m 1 | cut -f1 -d"." | cut -f2 -d" " ;sleep 1; done | stag -t "CPU"&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id="Android+battery+status" name="Android+battery+status"&gt;&lt;a class="hash-link" href="#Android+battery+status"&gt;Android battery status&lt;/a&gt;&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;while true; do termux-battery-status | jq .percentage;sleep 60; done | stag -t "Battery Stats"&lt;/code&gt;&lt;/pre&gt;</description>
    <pubDate>Sat, 16 Jan 2016 00:00:00 +0000</pubDate>
    <link>https://glow.li/posts/compiling-stag-on-termux/</link>
    <guid isPermaLink="false">1452902400</guid>
</item>

<item>
        <title>Compile tty-clock on Termux</title>
        <description>&lt;p&gt;&lt;strong&gt;This post is now obsolete. You can install &lt;code&gt;tty-clock&lt;/code&gt; from the repository.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://glow.li/media/images/Screenshot-tty-clock.webp?chash=Iebu889fa8" alt="Screenshot" title="Screenshot" class="right size-half" loading="lazy" sizes="(max-width:703px) 100vw, 750px" srcset="https://glow.li/media/images/Screenshot-tty-clock.webp?chash=Iebu889fa8 1500w, https://glow.li/media/images/1200/Screenshot-tty-clock.webp?chash=Iebu8884d3 1200w, https://glow.li/media/images/1000/Screenshot-tty-clock.webp?chash=Iebu8884d3 1000w, https://glow.li/media/images/800/Screenshot-tty-clock.webp?chash=Iebu8884d3 800w, https://glow.li/media/images/700/Screenshot-tty-clock.webp?chash=Iebu8884d3 700w, https://glow.li/media/images/600/Screenshot-tty-clock.webp?chash=Iebu8884d3 600w, https://glow.li/media/images/500/Screenshot-tty-clock.webp?chash=Iebu8884d3 500w, https://glow.li/media/images/400/Screenshot-tty-clock.webp?chash=Iebu8884d3 400w, https://glow.li/media/images/300/Screenshot-tty-clock.webp?chash=Iebu865f03 300w, https://glow.li/media/images/200/Screenshot-tty-clock.webp?chash=Iebu8ed21f 200w, https://glow.li/media/images/100/Screenshot-tty-clock.webp?chash=Iebu80a617 100w" &gt;
&lt;a href="https://github.com/xorg62/tty-clock"&gt;Tty-clock&lt;/a&gt; is a small program that displays a digital clock.&lt;/p&gt;
&lt;!--more--&gt;
&lt;p&gt;To compile it on &lt;a href="https://termux.com/"&gt;Termux&lt;/a&gt; you'll need to download the sources from GitHub.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;git clone https://github.com/xorg62/tty-clock.git&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You'll also need the &lt;code&gt;ncurses-dev&lt;/code&gt; package.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;apt install ncurses-dev&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sadly, compiling with &lt;code&gt;make&lt;/code&gt; doesn't really work with this one, I managed to compile it with the following command.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gcc -Wall -Werror -Wextra -std=c99 -pedantic -Wno-unused-parameter -lncurses -o tty-clock ttyclock.c&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can then install it with &lt;code&gt;make install&lt;/code&gt;.&lt;/p&gt;</description>
    <pubDate>Sat, 16 Jan 2016 00:00:00 +0000</pubDate>
    <link>https://glow.li/posts/compiling-tty-clock-on-termux/</link>
    <guid isPermaLink="false">1452902400</guid>
</item>

<item>
        <title>Android notifications for WeeChat in Termux</title>
        <description>&lt;p&gt;&lt;a href="https://glow.li/media/images/big/Screenshot-weechat-termux.webp?chash=Iebu80944a"&gt;&lt;img src="https://glow.li/media/images/Screenshot-weechat-termux.webp?chash=Iebu888662" alt="Screenshot" title="Screenshot" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/Screenshot-weechat-termux.webp?chash=Iebu888662 1500w, https://glow.li/media/images/1200/Screenshot-weechat-termux.webp?chash=Iebu8eb586 1200w, https://glow.li/media/images/1000/Screenshot-weechat-termux.webp?chash=Iebu8eb586 1000w, https://glow.li/media/images/800/Screenshot-weechat-termux.webp?chash=Iebu8eb586 800w, https://glow.li/media/images/700/Screenshot-weechat-termux.webp?chash=Iebu8eb586 700w, https://glow.li/media/images/600/Screenshot-weechat-termux.webp?chash=Iebu8eb586 600w, https://glow.li/media/images/500/Screenshot-weechat-termux.webp?chash=Iebu8eb586 500w, https://glow.li/media/images/400/Screenshot-weechat-termux.webp?chash=Iebu8eb586 400w, https://glow.li/media/images/300/Screenshot-weechat-termux.webp?chash=Iebu8eb586 300w, https://glow.li/media/images/200/Screenshot-weechat-termux.webp?chash=Iebu886604 200w, https://glow.li/media/images/100/Screenshot-weechat-termux.webp?chash=Iebu8b2a5d 100w" &gt;&lt;/a&gt;
I figured out how to have WeeChat in &lt;a href="https://termux.com/"&gt;Termux &lt;/a&gt; create a notification on your android device whenever someone mentions your username or you receive a private message.&lt;/p&gt;
&lt;p&gt;You need to have &lt;a href="https://f-droid.org/en/packages/com.termux.api/"&gt;Termux:API&lt;/a&gt; installed for this.
&lt;code&gt;All&lt;/code&gt; you need to do is type following command into WeeChat:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/set trigger.trigger.beep.command "/print -beep;/exec -bg termux-notification -t 'IRC Notification' -c "${tg_tag_nick}: ${tg_message_nocolor}";/exec -bg termux-vibrate"&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id="Explanation" name="Explanation"&gt;&lt;a class="hash-link" href="#Explanation"&gt;Explanation&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Normal WeeChat behavior is to send a BEL character to the terminal whenever someone mentions you or sends you a private message. This extends that with the commands termux-notification and termux-vibrate found in the &lt;a href="https://f-droid.org/en/packages/com.termux.api/"&gt;Termux:API&lt;/a&gt;. The content of the notification is ${tg_tag_nick} (which is the user who sent you the message) and ${tg_message_nocolor} (which is the message without coloring). &lt;a href="https://weechat.org/files/doc/devel/weechat_user.en.html#trigger_data_print"&gt;Here&lt;/a&gt; you can find more available variables.&lt;/p&gt;</description>
    <pubDate>Tue, 05 Jan 2016 12:30:59 +0000</pubDate>
    <link>https://glow.li/posts/android-notifications-for-weechat-in-termux/</link>
    <guid isPermaLink="false">1451997059</guid>
</item>

<item>
        <title>Run an SSH server on your Android with Termux</title>
        <description>&lt;p&gt;With the brilliant &lt;a href="https://termux.com/"&gt;Termux&lt;/a&gt; terminal emulator app you can run an SSH server on your Android.&lt;/p&gt;
&lt;p&gt;Previously I used SSHDroid (which is no longer available) to achieve this, but with Termux is much nicer because you have access to a working package manager.&lt;/p&gt;
&lt;h2 id="Run+the+service" name="Run+the+service"&gt;&lt;a class="hash-link" href="#Run+the+service"&gt;Run the service&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You need to install the OpenSSH package&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    apt install openssh&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and use following command to start the ssh server.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    sshd&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And there you go. Your ssh service is now running on port 8022.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    ssh localhost -p 8022&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="Adding+your+Public+key" name="Adding+your+Public+key"&gt;&lt;a class="hash-link" href="#Adding+your+Public+key"&gt;Adding your Public key&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can't do password authentication in Termux, therefore you need to put your OpenSSH public key into the ~/.ssh/authorized_keys file.&lt;/p&gt;
&lt;p&gt;This file will need to be created and permissions set to 600.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    touch ~/.ssh/authorized_keys
    # Set Permissions to the file
    chmod 600 ~/.ssh/authorized_keys
    # Make sure the folder .ssh folder has the correct permissions
    chmod 700 ~/.ssh&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you do not have a OpenSSH key pair yet, you can generate one with the following command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    ssh-keygen&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You may or may not enter a passphrase and if you don't specify otherwise, your key pair will have been saved under ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub. You can then add it to the ~/.ssh/authorized_keys with&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    cat ~/.ssh/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys
    chmod 600 ~/.ssh/authorized_keys&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then you can test it by connecting to your ssh service&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    # -i $PATH_TO_FILE/filename is only required if the id_rsa file is not ~/.ssh/id_rsa
    ssh localhost -p 8022 -i %PATH_TO_KEY-FILE%/%NAME_OF_KEY%&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can now use your private key (~/.ssh/id_rsa) to login to your Termux SSH Server. Simply copy it to your computer (by copying it to internal storage first &lt;code&gt;cp ~/.ssh/id_rsa /sdcard&lt;/code&gt;) and use it in your ssh client.&lt;/p&gt;
&lt;h3 id="OpenSSH" name="OpenSSH"&gt;&lt;a class="hash-link" href="#OpenSSH"&gt;OpenSSH&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you're using OpenSSH (on Linux or Cygwin) you can use it directly:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    # -i $PATH_TO_FILE/filename is only required if the id_rsa file is not ~/.ssh/id_rsa
    ssh $IP -p 8022 -i %PATH_TO_KEY-FILE%/%NAME_OF_KEY%&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id="PuTTY" name="PuTTY"&gt;&lt;a class="hash-link" href="#PuTTY"&gt;PuTTY&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you're using PuTTY you will need to convert it to the PuTTY Private Key format first.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download and run &lt;a href="https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html"&gt;PuTTYgen&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Load the private key (id_rsa)&lt;/li&gt;
&lt;li&gt;Save the private key as a *.ppk file.&lt;/li&gt;
&lt;li&gt;Download and run &lt;a href="https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html"&gt;PuTTY &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Enter the IP address of your Android device and use port 8022&lt;/li&gt;
&lt;li&gt;Under Connection&amp;gt;SSH&amp;gt;Auth you can browse for the *.pkk file&lt;/li&gt;
&lt;li&gt;Click open&lt;/li&gt;
&lt;li&gt;You can leave "login as:" blank&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You should now be connected to your Android device via SSH.&lt;/p&gt;
&lt;h3 id="If+it+still+doesn%27t+work" name="If+it+still+doesn%27t+work"&gt;&lt;a class="hash-link" href="#If+it+still+doesn%27t+work"&gt;If it still doesn't work&lt;/a&gt;&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;    killall sshd
    sshd -d&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If it is still prompts you for a password you can enter sshd's debug mode with the above command and see exactly why your key has been rejected. The reason usually are bad permission on either your home directory, your .ssh folder or your authorized_keys file.&lt;/p&gt;
&lt;p&gt;The correct permissions are:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    chmod 700 ~
    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/*&lt;/code&gt;&lt;/pre&gt;
&lt;hr &gt;
&lt;p&gt;I hope in the future Termux will allow us to register sshd as a proper service which would automatically start on system boot. Right now I have the 'sshd' command in my .bashrc file and I am using &lt;a href="https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm"&gt;Tasker &lt;/a&gt;to launch Termux after boot. You can also use the &lt;a href="https://play.google.com/store/apps/details?id=com.termux.widget&amp;amp;hl=en"&gt;Termux widget&lt;/a&gt; to quickly start sshd with a widget.&lt;/p&gt;
&lt;p&gt;See also: &lt;a href="https://glow.li/posts/access-termux-via-usb/"&gt;Access the SSH server via USB instead of WiFi&lt;/a&gt;&lt;/p&gt;</description>
    <pubDate>Fri, 06 Nov 2015 17:48:05 +0000</pubDate>
    <link>https://glow.li/posts/run-an-ssh-server-on-your-android-with-termux/</link>
    <guid isPermaLink="false">1446832085</guid>
</item>

<item>
        <title>Display Swatch Internet Time (beats) in Zooper</title>
        <description>&lt;p&gt;&lt;a href="https://glow.li/media/images/big/beat-screenshot.webp?chash=Iebu8ce7ec"&gt;&lt;img src="https://glow.li/media/images/beat-screenshot.webp?chash=Iebu85149a" alt="beat screenshot" title="beat screenshot" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/beat-screenshot.webp?chash=Iebu85149a 1500w, https://glow.li/media/images/1200/beat-screenshot.webp?chash=Iebu85130c 1200w, https://glow.li/media/images/1000/beat-screenshot.webp?chash=Iebu85130c 1000w, https://glow.li/media/images/800/beat-screenshot.webp?chash=Iebu85130c 800w, https://glow.li/media/images/700/beat-screenshot.webp?chash=Iebu85130c 700w, https://glow.li/media/images/600/beat-screenshot.webp?chash=Iebu85130c 600w, https://glow.li/media/images/500/beat-screenshot.webp?chash=Iebu81013e 500w, https://glow.li/media/images/400/beat-screenshot.webp?chash=Iebu89e1aa 400w, https://glow.li/media/images/300/beat-screenshot.webp?chash=Iebu8d636d 300w, https://glow.li/media/images/200/beat-screenshot.webp?chash=Iebu84c7b9 200w, https://glow.li/media/images/100/beat-screenshot.webp?chash=Iebu894560 100w" &gt;&lt;/a&gt;
Did you ever want Zooper to display Time in &lt;a href="https://en.wikipedia.org/wiki/Swatch_Internet_Time"&gt;.beats&lt;/a&gt;? Probably not. Here's how anyway:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@$(floor(((#Dss#)+(#Dmm#*60)+((#DH#+1)*3600))/86.4))$&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This does the math. Just add a Text or Rich Text module, "Edit text manually" and insert this.&lt;/p&gt;
&lt;p&gt;You will have to also tap "Override widget Locality" add a location, enter any city and manually set the timezone to UTC. This is because it Swatch Internet Time doesn't have time zones but can be calculated from Biel Meantime (BMT). @0 is midnight in Biel, where the Swatch headquarters is located.&lt;/p&gt;
&lt;p&gt;You can also download this as a template: &lt;a href="https://glow.li/media/files/Swatch_Internet_Time.zw"&gt;Swatch Internet Time.zw&lt;/a&gt;&lt;/p&gt;</description>
    <pubDate>Fri, 30 Oct 2015 18:17:50 +0000</pubDate>
    <link>https://glow.li/posts/beats-with-zooper/</link>
    <guid isPermaLink="false">1446229070</guid>
</item>

    </channel>
</rss>

