Termux-packages: 'who' command?

Created on 27 Dec 2017  路  14Comments  路  Source: termux/termux-packages

I'd like to install the who command, but I can't figure out which package would contain it. Suggestions? Thanks!

enhancement

Most helpful comment

Termux does not support utmp/wtmp/btmp files so command "who" is useless here because it will display nothing.

All 14 comments

Bash.

@Atavic , @Grimler91 I have bash installed, but am still missing the who commnad. Am I missing something basic here, or should I open a new ticket?

2017-12-27 17 26 09

I thought I used to have who, but I don't, now. It's not listed in help, either.

@MinchinWeb you're right, it's missing. Sorry for closing.

Wait, did you mean whoami? whoami has no spaces.

I'm trying to use liquidprompt, which relies on who am i (yes, with the spaces).

Google tells me who is actually part of coreutils but it is actually disabled without a ton of explanation.

Another ticket about who missing.

@MinchinWeb who is available in Arch Linux Termux PRoot on Android, Chromebook and Fire. It doesn't work as expected, and this is due to app permissions.

[20:43 home ]$ who 
[20:56 home ]$ who -a
[20:56 home ]$ who --all
[20:57 home ]$ who --version
who (GNU coreutils) 8.28
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Joseph Arceneaux, David MacKenzie, and Michael Stone.

Termux is single-user, so commands like who, users, last will not work.

@xeffyr have you used adduser then su - username in Arch Linux in Termux PRoot?

@sdrausty, topic about using who in Termux, not in Arch Linux. I'll try su in Arch Linux, but I guess it will fail under PRoot.

@xeffyr Arch Linux in Termux PRoot is on topic for more than the next three reasons.
a) Arch Linux runs in Termux on device affording packages galore on device today, including building packages on device.
b) Termux PRoot https://github.com/termux/proot is used to make this work.
c) It is a very important on device diagnostic tool. See https://github.com/termux/termux-packages/issues/1798 for one of the results. Does it work on device and how it works on device comparison is critical for expedient diagnosis.

Using multiuser mode in Arch Linux in Termux PRoot is necessary to access some features that do not run as root user in Arch Linux in Termux PRoot. Use adduser then su - username to login as a user, not root.

Termux does not support utmp/wtmp/btmp files so command "who" is useless here because it will display nothing.

maybe you can use this script
i use this script and invoke by sshd command when open termux

#!/usr/bin/env python
"""
summary:
    termux python script
    monitor tty login
python:
    python3.x
usage:
    python monitor_tty.py
"""
import os
import time
from collections import deque

g_cache_que = deque(maxlen=100)


def tty_wall(msg):
    cmd_msg = "\x1b[92m" + msg + "\033[0m"
    for i in range(1, 100):
        tty_fn = "/dev/pts/{}".format(i)
        if os.path.exists(tty_fn):
            cmds = "echo {msg} > {fn}".format(msg=cmd_msg, fn=tty_fn)
            os.system(cmds)


def monitor_tty():
    p = "/dev/pts/{}"
    for i in range(1, 100):
        tty_f = p.format(i)
        if os.path.exists(tty_f):
            tty_ctime = os.stat(tty_f).st_ctime
            if tty_ctime not in g_cache_que:
                g_cache_que.append(tty_ctime)
                tty_wall('someone login in other tty')


def main():
    while 1:
        monitor_tty()
        time.sleep(3)


if __name__ == '__main__':
    main()

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adit picture adit  路  3Comments

thurask picture thurask  路  3Comments

reggi picture reggi  路  4Comments

newmania picture newmania  路  3Comments

zejji picture zejji  路  4Comments