Obtain the remote username?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Obtain the remote username?
# 1  
Old 06-08-2009
Obtain the remote username?

Hi,

I'm new to Unix scripting so I'm hoping someone can help me out.

I have trawled the web trying to find an answer to this but have not been able to find out anything.

I'm trying to create a script that when supplied with a hostname, will find out information about the remote machine.

I know the admin account details on the remote machine, and can obtain the IP address no problem, but I'm having trouble finding out how to obtain the username of the person that is currently logged into the machine.

Just so I can make this clear, I do not want to copy the script onto the remote machine and run it (as in copy the script to the machine and 'whoami'). I actually want to try and obtain the username remotely.

I realize that this may not be possible due to security reasons.

Any ideas?

Many thanks for any help.
# 2  
Old 06-08-2009
You could use the ident protocol, but this can only tell you which user is the owner of a connection. Another way may be to ssh into the other host and running 'who' to get a list of all users currently connected.
# 3  
Old 06-08-2009
Quote:
Originally Posted by pludi
You could use the ident protocol, but this can only tell you which user is the owner of a connection. Another way may be to ssh into the other host and running 'who' to get a list of all users currently connected.
Many thanks Pludi for the reply. ident may be the way to go with this.

I did think about the ssh solution but unfortunately that would mean having to go around and turning on ssh on all the computers that we administer.

Once again thanks for the help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Why does "ps -[u|U] username" not list processes when username is numeric?

Greetings, The title pretty much says it all. I've snooped everywhere and can't find anything on this. Since our organization went to numeric usernames, using the u|U option for ps returns no processes. Example passwd entry: 320074:DjZAJKXun8HBs:10129:6006:Joe Y:/cadhome/analysis/jy:/bin/bash... (4 Replies)
Discussion started by: crimso
4 Replies

2. Shell Programming and Scripting

How to obtain info from whois?

Hello, do you know any clever way to get information whether certain domain name become avaialble for registration from bash script? Would be good to check for the availability like every 100miliseconds, i want to catch domain. (1 Reply)
Discussion started by: postcd
1 Replies

3. Shell Programming and Scripting

Connect to Remote DB2 ,using URL ,username,Password

Hi All, I am new to Shell scripting, I want to connect to DB2 database through URL,username and password Please help me out. I read so many posts in that there is no where it is mentioned about how to connect to a remote database. Thanks in advance :) (0 Replies)
Discussion started by: Rohit G
0 Replies

4. Shell Programming and Scripting

how to obtain a variable between subroutines

#!/usr/bin/bash sub1 () { for ((i=0;i<10;i++)) do export a=$i; echo "value of a is $a"; sleep 1 done } sub1 & sub2 () { for ((j=0;j<10;j++)) do echo "value of a is $a"; sleep 1 done } (5 Replies)
Discussion started by: Arun_Linux
5 Replies

5. Shell Programming and Scripting

Expect script: obtain the exit code of remote command

Hi all, I'm trying to run the sipp simulator in crontab but after some attempt I came to the conclusion that for some reason this isn't possible (maybe due to sipp interactive nature). This is confirmed by these posts. Now I'm trying to launch sipp from an expect script that runs in crontab. ... (0 Replies)
Discussion started by: Evan
0 Replies

6. Programming

to obtain users of each group in c

Hello They have ordered to me that makes several small utilities in C/C++ for the servants, among them a small program in C/C++ to generate a file HTML with the groups of that servant and in addition that is the corresponding users of that group. For example of a group: Group: Sys Members:... (2 Replies)
Discussion started by: cybermeis
2 Replies

7. UNIX for Dummies Questions & Answers

How to obtain list of users ?

How to obtain list of users found in /home/ and append it to a file. (7 Replies)
Discussion started by: bobby36
7 Replies

8. HP-UX

How can I obtain Hpux?

Hi, How can I obtain Hpux? Thanks (4 Replies)
Discussion started by: arabidi
4 Replies

9. UNIX for Dummies Questions & Answers

Remote Copy without entering Username and Password

I tried the following script to copy one file automatically: #!/bin/csh -f su - root -c "rcp 150.10.128.1:/export/home/sn408Xl/sn408Sol/$fn $fn This works fine but is there a better way to copy remotely without entering the username and password? Moreover, after the file is copied a... (1 Reply)
Discussion started by: ilak1008
1 Replies

10. UNIX for Dummies Questions & Answers

Where to obtain FreeBSD?

Anyone help ! From where can I download a free version of FreeBSD ? I am trying to teach myself this OS, have all the documentation needed, but am short the OS itself. If anyone can send me a link, I would be most appreciative ! (3 Replies)
Discussion started by: treborwallace
3 Replies
Login or Register to Ask a Question