Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello everyone, I tried searching on google but not finding answers, I decided to post an interesting topic I hope for you too. Having logged in "es. 4 user" on my Debian, eg. from 4 different locations all with the logged user "debian" from one of these positions as I can do a logout of a single host connected? I try to explain better: - 4 hosts connected to the Debian server as a "debian". - From one of these hosts using "who-to" visualize all user related, but all are "debian", if I want to disconnect, and of course stop the operation that was running as that user I can do? using pkill-u debian-kill me disconnettte them all. thanks
to identify you can use the command last. You may need to use grep/awk to find out the the important lines probably, you need to investigate what is the way you like.
Hello everyone, I tried searching on google but not finding answers, I decided to post an interesting topic I hope for you too. Having logged in "es. 4 user" on my Debian, eg. from 4 different locations all with the logged user "debian" from one of these positions as I can do a logout of a single host connected? I try to explain better: - 4 hosts connected to the Debian server as a "debian". - From one of these hosts using "who-to" visualize all user related, but all are "debian", if I want to disconnect, and of course stop the operation that was running as that user I can do? using pkill-u debian-kill me disconnettte them all. thanks
You can start by using 'last' as suggested by @pan64 in order to find the the tty and the location of users. For example:
Code:
└─› last | head | grep ^d
d pts/9 host/ip Sat Jun 2 20:13 still logged in
d ssh host/ip Sat Jun 2 20:13 still logged in
=> d pts/8 host/ip Sat Jun 2 20:13 still logged in <=
d ssh host/ip Sat Jun 2 20:13 - 20:13 (00:00)
d pts/7 host/ip Sat Jun 2 20:13 still logged in
d ssh host/ip Sat Jun 2 20:13 - 20:13 (00:00)
then you can get the processes executed by your user, by executing:
Code:
└─› ps -fu d
UID PID PPID C STIME TTY TIME CMD
d 17943 17917 0 Mar23 ? 00:00:00 sshd: d@pts/7
d 17946 17943 0 Mar23 pts/7 00:00:00 -bash
d 17987 17973 0 Mar23 ? 00:00:00 sshd: d@pts/8
d 17993 17987 0 Mar23 pts/8 00:00:00 -bash
d 18021 18001 0 Mar23 ? 00:00:00 sshd: d@pts/9
d 18022 18021 0 Mar23 pts/9 00:00:00 -bash
d 18858 17993 0 Mar23 pts/8 00:00:00 vim /home/d/example.txt
** in this example my user is 'd'.
so let's say I want to kill the session for the user 'd' logged in from 'host/ip', using the tty 'pts/8' which is running 'vim' for example. I would kill the '-bash' process which will kill user's session.
Code:
└─› kill -9 17993
or better yet you may want to send a SIGHUP (-HUP switch) to the PID instead of killing it with '-9' priority, because this will allow them to exit gracefully.
so you have a solution? Is this ok, or you have still some troubles? Why do you need another solution?
__________________________________
Happy with solution ... mark as SOLVED
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.