Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Find number of ACTIVE SSH putty sessions, excluding where the user hopped on to a diff server Post 303032907 by i4ismail on Tuesday 26th of March 2019 01:40:18 PM
Old 03-26-2019
Find number of ACTIVE SSH putty sessions, excluding where the user hopped on to a diff server

Hi - If iam logged on to server A, on 4 putty windows using SSH ... and out of these 4 logged-in sessions, in one of the sessions if i did SSH from server A to server B;

i would now have 4 putty windows sessions ... of which 3 are actively logged on to Server A while 1 putty window is actively logged on to server B.

Now on server A, is there any command that can give me the current ACTIVE logged in sessions count ? that is it should return 3 and NOT 4.

PS : Iam not a root user nor an admin. So will not have access to log of admin logs/commands

Last edited by i4ismail; 03-26-2019 at 02:53 PM.. Reason: typo
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find match in two diff file - local srv and remote server

Perl Guru.... I need to compare two diff file (file1.abc will locate in current server and file2.abc will locate in remote server), basically the script will look for match in both file and only will send out email if there is no match and also give me list of unmatch and dups as well. So... (0 Replies)
Discussion started by: amir07
0 Replies

2. UNIX for Advanced & Expert Users

Max sessions a single user can've on Solaris server at the same time

There's a user that opens various login sessions with a particular SOLARIS server at the same time - this locks the server thats tried to get logged into.. Kindly help on how to know the max limit of sessions a particular user can open with a particular server at the same time. AND, how to... (2 Replies)
Discussion started by: its.simron
2 Replies

3. Shell Programming and Scripting

Find all files for a user, excluding a directory

I have been searching, and cannot find an answer for this. I am trying to find all files for a user, lets call him (test001), and I want to exclude a specific directory. Here is the command I run, it finds all files: find / -user test001 I get this result: > find / -user test001 ... (4 Replies)
Discussion started by: steve2x4
4 Replies

4. Shell Programming and Scripting

Getting error while getting status of active and inactive sessions from ORACLE DB

Hi All, I have a written a test script which retrieves the status of active and inactive sessions from oracle DB, but i am receiving error while executing. My script is filepath="/home/ocsg/scripts/db_session_report/current_session_report.txt"... (1 Reply)
Discussion started by: poweroflinux
1 Replies

5. Web Development

How to find number of http connections active currently in apache web server

Hi I have a solaris 9 OS with apache web server running on top of it. i want to know how many http connections are active at any point in time. (In other words how many users are accessing my website it at any moment of time) How to get it..? hit counters are not required... ----------... (0 Replies)
Discussion started by: aemunathan
0 Replies

6. Shell Programming and Scripting

Putty shortcut and ssh to another server question, possible in bash?

Hi, sorry if this is the wrong forum for this question but I couldnt spot another obvious forum for it. I have a windows shortcut which opens up a saved session in putty. From this session I then ssh to another remote server. I was wondering is there a way that I can either edit my shortcut... (5 Replies)
Discussion started by: newb1000
5 Replies

7. UNIX for Dummies Questions & Answers

Active sessions open or long time

What kind of problems can be faced if any session which connects to unix server is open for longer time? How to find out from how much time that session is idle? :) (2 Replies)
Discussion started by: anandgodse
2 Replies

8. Shell Programming and Scripting

How do I calculate total number of active and non active hosts?

#!/bin/bash for digit in $(seq 1 10) do if ping -c1 -w2 192.168.1.$digit &> /dev/null then echo "192.168.1.$digit is UP" else echo "192.168.1.$digit is DOWN" fi done (3 Replies)
Discussion started by: fusetrips
3 Replies

9. Shell Programming and Scripting

Find active SSH servers w/ ssh keys on LAN

Hi, I am trying to complete my bash script in order to find which SSH servers on LAN are still active with the ssh keys, but i am frozen at this step: #!/bin/bash # LAN SSH KEYS DISCOVERY SCRIPT </etc/passwd \ grep /bin/bash | cut -d: -f6 | sudo xargs -i -- sh -c ' && cat... (11 Replies)
Discussion started by: syrius
11 Replies
SD_UID_GET_STATE(3)						 sd_uid_get_state					       SD_UID_GET_STATE(3)

NAME
sd_uid_get_state, sd_uid_is_on_seat, sd_uid_get_sessions, sd_uid_get_seats - Determine login state of a specific Unix user ID SYNOPSIS
#include <systemd/sd-login.h> int sd_uid_get_state(uid_t pid, char** state); int sd_uid_is_on_seat(uid_t pid, int require_active, const char* seat); int sd_uid_get_sessions(uid_t pid, int require_active, char*** sessions); int sd_uid_get_seats(uid_t pid, int require_active, char*** seats); DESCRIPTION
sd_uid_get_state() may be used to determine the login state of a specific Unix user identifier. The following states are currently known: offline (user not logged in at all), lingering (user not logged in, but some user services running), online (user logged in, but not active), active (user logged in on an active seat). In the future additional states might be defined, client code should be written to be robust in regards to additional state strings being returned. The returned string needs to be freed with the libc free(3) call after use. sd_uid_is_on_seat() may be used to determine whether a specific user is logged in or active on a specific seat. Accepts a Unix user identifier and a seat identifier string as parameters. The require_active parameter is a boolean. If non-zero (true) this function will test if the user is active (i.e. has a session that is in the foreground and accepting user input) on the specified seat, otherwise (false) only if the user is logged in (and possibly inactive) on the specified seat. sd_uid_get_sessions() may be used to determine the current sessions of the specified user. Acceptes a Unix user identifier as parameter. The require_active boolean parameter controls whether the returned list shall consist of only those sessions where the user is currently active (true) or where the user is currently logged in at all, possibly inactive (false). The call returns a NULL terminated string array of session identifiers in sessions which needs to be freed by the caller with the libc free(3) call after use, including all the strings referenced. If the string array parameter is passed as NULL the array will not be filled in, but the return code still indicates the number of current sessions. Note that instead of an empty array NULL may be returned and should be considered equivalent to an empty array. Similar, sd_uid_get_seats() may be used to determine the list of seats on which the user currently has sessions. Similar semantics apply, however note that the user may have multiple sessions on the same seat as well as sessions with no attached seat and hence the number of entries in the returned array may differ from the one returned by sd_uid_get_sessions(). RETURN VALUE
On success sd_uid_get_state() returns 0 or a positive integer. If the test succeeds sd_uid_is_on_seat() returns a positive integer, if it fails 0. sd_uid_get_sessions() and sd_uid_get_seats() return the number of entries in the returned arrays. On failure, these calls return a negative errno-style error code. NOTES
The sd_uid_get_state(), sd_uid_is_on_seat(), sd_uid_get_sessions(), and sd_uid_get_seats() interfaces are available as shared library, which can be compiled and linked to with the libsystemd-login pkg-config(1) file. SEE ALSO
systemd(1), sd-login(7), sd_pid_get_owner_uid(3) AUTHOR
Lennart Poettering <lennart@poettering.net> Developer systemd 10/07/2013 SD_UID_GET_STATE(3)
All times are GMT -4. The time now is 05:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy