Determining if session is a login session


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Determining if session is a login session
Prev   Next
# 1  
Old 03-02-2010
Determining if session is a login session

Besides 'who am i' and 'tty' what commands could be used to determine if a session is interactive as compared to a web process or cron process. Any command should work with the common unix variants.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Difference between the desktop session and console session

what is the difference between desktop session and console session in solaris as i am wondering we use option -text for the former and -nowin for the later (1 Reply)
Discussion started by: kishanreddy
1 Replies

2. Shell Programming and Scripting

Record login session...

How to record my login session in a file named session.lst? (1 Reply)
Discussion started by: anupdas
1 Replies

3. Solaris

I am not able to login in gnome session and java session in Sun solaris 9& 10

I am not able to login in gnome session and java session in Sun solaris 9& 10 respectively through xmanager as a nis user, I am able to login in common desktop , but gnome session its not allowing , when I have given login credentials, its coming back to login screen, what shoul I do to allow nis... (0 Replies)
Discussion started by: durgaprasadr13
0 Replies

4. Shell Programming and Scripting

Hiding Directories on a Session by Session basis

Hi, Apologies if anyone has read my recent post on the same subject in the Linux forum, just thought actually the solution might more likely come from scripting. Essentially, I am trying to restrict access to directories based on the user's name AND their location on a session-by-session... (3 Replies)
Discussion started by: en7smb
3 Replies

5. Shell Programming and Scripting

Perl website login and session

Hi, I'm currently working on a perl website, and I would need a system where a few users can login into the administration side of the site. about 5-10 users maximum, all pretty simple. I was thinking of using an .htaccess file and a seperate admin folder on the server. I'm wondering if there... (2 Replies)
Discussion started by: LNC
2 Replies

6. UNIX for Dummies Questions & Answers

Need a Help Please- Login a reflectionX session but what you type is not what you get

Im having a problem using unix program client ReflectionX. as soon as i login to one session i type to change to any directory or type something but the problem is that what i type in is not what you get. ie i type: $cd ~/alejo (to change HOME DIRECTORY - alejo subdirectory but when i type it... (2 Replies)
Discussion started by: alexcol
2 Replies

7. Shell Programming and Scripting

sqlplus session being able to see unix variables session within a script

Hi there. How do I make the DB connection see the parameter variables passed to the unix script ? The code snippet below isn't working properly. sqlplus << EOF user1@db1/pass1 BEGIN PACKAGE1.perform_updates($1,$2,$3); END; EOF Thanks in advance, Abrahao. (2 Replies)
Discussion started by: 435 Gavea
2 Replies

8. UNIX for Advanced & Expert Users

Unix login session and Password

Hi All, I've login to Unix using login name guest and I'm working on it, I need another session to run some script hence tried to login but password invalid it says here my question is : Since I'm in working in one session can I set the password without knowing old password? is there any... (1 Reply)
Discussion started by: krishna
1 Replies

9. UNIX for Advanced & Expert Users

User login session

Having a problem on AIX 4.3.3 with the following error when more than 2 users try and sign onto the server. 3004-312 All available login sessions are in use. ???? (1 Reply)
Discussion started by: Docboyeee
1 Replies
Login or Register to Ask a Question
SD_SESSION_IS_ACTIVE(3)                                        sd_session_is_active                                        SD_SESSION_IS_ACTIVE(3)

NAME
sd_session_is_active, sd_session_get_uid, sd_session_get_seat, sd_session_get_service, sd_session_get_type, sd_session_get_class, sd_session_get_display - Determine state of a specific session SYNOPSIS
#include <systemd/sd-login.h> int sd_session_is_active(const char* session); int sd_session_get_uid(const char* session, uid_t* uid); int sd_session_get_seat(const char* session, char** seat); int sd_session_get_service(const char* session, char** service); int sd_session_get_type(const char* session, char** type); int sd_session_get_class(const char* session, char** class); int sd_session_get_display(const char* session, char** display); DESCRIPTION
sd_session_is_active() may be used to determine whether the session identified by the specified session identifier is currently active (i.e. currently in the foreground and available for user input) or not. sd_session_get_uid() may be used to determine the user identifier of the Unix user the session identified by the specified session identifier belongs to. sd_session_get_seat() may be used to determine the seat identifier of the seat the session identified by the specified session identifier belongs to. Note that not all sessions are attached to a seat, this call will fail for them. The returned string needs to be freed with the libc free(3) call after use. sd_session_get_service() may be used to determine the name of the service (as passed during PAM session setup) that registered the session identified by the specified session identifier. The returned string needs to be freed with the libc free(3) call after use. sd_session_get_type() may be used to determine the type of the session identified by the specified session identifier. The returned string is one of x11, tty or unspecified and needs to be freed with the libc free(3) call after use. sd_session_get_class() may be used to determine the class of the session identified by the specified session identifier. The returned string is one of user, greeter or lock-screen and needs to be freed with the libc free(3) call after use. sd_session_get_display() may be used to determine the X11 display of the session identified by the specified session identifier. The returned string is one of needs to be freed with the libc free(3) call after use. If the session parameter of any of these functions is passed as NULL the operation is executed for the session the calling process is a member of, if there is any. RETURN VALUE
If the test succeeds sd_session_is_active() returns a positive integer, if it fails 0. On success sd_session_get_uid(), sd_session_get_service() and sd_session_get_seat() return 0 or a positive integer. On failure, these calls return a negative errno-style error code. NOTES
The sd_session_is_active(), sd_session_get_uid(), sd_session_get_service() and sd_session_get_seat() 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_session(3) AUTHOR
Lennart Poettering <lennart@poettering.net> Developer systemd 10/07/2013 SD_SESSION_IS_ACTIVE(3)