Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 3402  / 2 Years ago, fri, january 14, 2022, 3:36:28

When logging in via SSH, I'd like to know, during the execution of .bashrc, the name of the host that is connecting.


Ubuntu Server shows the prompt:


Last login: Fri Feb 14 11:34:55 2014 from somehost.local

...so this information is available somewhere.


How can I access it?


More From » bash

 Answers
0

If you type:



who


You'll see information about the logged in users. Amongst other things, you can see the host they're logged from. For instance, right now my laptop returns this:



who -u
darent tty6 2014-02-14 01:15 11:02 20339
darent tty7 2014-02-14 23:15 antic 31827 (:0)
darent pts/7 2014-02-14 23:14 00:46 30246 (helena.local)
darent pts/1 2014-02-14 23:16 . 1466 (:0)
darent pts/9 2014-02-14 23:19 00:25 302 (:0)


Where helena.local is the computer from which I'm connected trough ssh.


[#27001] Sunday, January 16, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ilityushing

Total Points: 18
Total Questions: 100
Total Answers: 113

Location: Senegal
Member since Wed, May 13, 2020
4 Years ago
;