Skip to content
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

loginctl show current session id #2356

Closed
saivert opened this issue Jan 18, 2016 · 2 comments
Closed

loginctl show current session id #2356

saivert opened this issue Jan 18, 2016 · 2 comments
Labels

Comments

@saivert
Copy link

saivert commented Jan 18, 2016

We need to be able to type something like
loginctl session-id
to get the session id of calling process.
That is: c1, c2, etc.. not what you get from getsid() system call.

@saivert
Copy link
Author

saivert commented Jan 18, 2016

closing as I finally figured out $XDG_SESSION_ID should have this. maybe a hint in the documentation would be nice.

@saivert saivert closed this as completed Jan 18, 2016
@poettering
Copy link
Member

You can use $XDG_SESSION_ID for this, or when using C, you may use the sd_pid_get_session(0, &session) call, exported from libsystemd (it has a man page). The latter cannot be overriden by the user, the former of course can. Also note that most "loginctl" commands nowadays default to the calling user's session.

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

No branches or pull requests

2 participants