New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOSTNAME enviromental variable is localhost not system name #352

Open
timoc opened this Issue Jul 9, 2016 · 5 comments

Comments

Projects
None yet
5 participants
@timoc

timoc commented Jul 9, 2016

This should be the system hostname, or the phones name. This name is the one usually registered in the local dns when connected to a wifi network. having the hostname in the PS1 will make it easier for people to set up ssh connections as all they should need is

ssh -p 8022 termux@<phonename>

and/or can add this to their ssh config (assuming the phone is called myphone)

Host myphone
    HostName myphone
    User termux
    Port 8022 
    ForwardX11 yes
    ForwardX11Trusted yes
    IdentitiesOnly yes
    IdentityFile ~/.ssh/termux.key

which allow people to just

ssh myphone

which works with emacs tramp for editing files on the phone filesystem

@fornwall

This comment has been minimized.

Contributor

fornwall commented Jul 19, 2016

I don't think Android (as of 5.0 or later) allows setting a system hostname. At least not without root - do you have a root setup where you can test this?

@timoc

This comment has been minimized.

timoc commented Jul 26, 2016

I guess hostname The hostname issue I have looked into, but i cannot find the detail. Usually there is a device ID that is used for the hostname, and this is part of the android platform. If you can publish this, then that would be a good substitute.

The above process also works by using IP address.

HostName 172.1.1.1

And can be added to the documentation

@Neo-Oli Neo-Oli added the enhancement label Jul 29, 2016

@Exaeta

This comment has been minimized.

Exaeta commented Aug 21, 2016

Hello! Android does have hostnames. Hostnames are required of all network devices... normally it is something like "android38793629130". Not being able to use a custom hostname without root is not the same as not having a hostname at all!

@Exaeta

This comment has been minimized.

Exaeta commented Aug 21, 2016

Add the following to ~/.bash_profile:

GREEN="\[$(tput setaf 2)\]"
RESET="\[$(tput sgr0)\]"

export PS1="${GREEN}\$(id -n -u)@\$(getprop net.hostname):\$(pwd)${RESET}\$ "
@metimocyn

This comment has been minimized.

metimocyn commented May 16, 2017

Maybe this can be added to the sshd script, or another termux script that will tell you about your local network environs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment