Programming :: Kill Pids For All Sessions For A Specific User Except Their Current One?
Oct 20, 2010
I have several users on handhelds and they like to let their sessions time out. Their zombie processes then cause record locks.I've come up with calls for killing the pids for any prior sessions started by a given user. This procedure would be executed in the .bash_profile.
View 3 Replies
ADVERTISEMENT
Jan 12, 2011
What functions are available on linux for a c++ program to determine if the current user is a member of a specific user group?
View 3 Replies
View Related
Apr 8, 2009
I look after a server which accepts automatic overnight PASV FTP uploads from remote clients. When the uploads are complete, my Bash script copies the files to another location. The problem is, my script needs to be a bit smarter when it comes to detecting active FTP sessions.
I was using:
Code:
netstat -n | grep ":21 " | grep ESTABLISHED
to test if there were active sessions, but came unstuck when a local user left an unrelated FTP session active. The result - my script hung around all night thinking there was an active upload from a remote client. My server is behind a firewall, so remote clients all show an internal (NAT) address,so I can't differentiate by source IP address.I can't install LSOF or FUSER for security reasons. Is there a way I can test for active FTP sessions from specific users? I am running Red Hat Enterprise Linux Server release 5.2 (Tikanga).
View 7 Replies
View Related
Apr 24, 2009
My co-worker and I are working on this robotics project where robots are controlled over the web. I don't want to go into all the details, but basically the users visit a page where they have access to a PHP-based interface that allows them to send commands to robots in our tech lab (via an intermediate server). Our web server is running Apache.
Anyway, now we need to implement session control, with user-names and passwords so that only certain people can have access to the interface at a certain time, with access to only certain robots, et cetera. We were hoping there was some kind of pre-fab FOSS solution for handling both the session control and maintaining the MySQL user/password database.
My co-worker knows a little PHP, and I know a little MySQL, but we are both noobs enough that we would prefer to do as little of this from scratch as is possible. We don't have a lot of time, and I know it is easy for inexperienced MySQL programmers to introduce security vulnerabilities.
View 1 Replies
View Related
Nov 1, 2010
The first two sessions are my gnome and my terminal. The last three are remote ones that somehow got stuck on when using FreeNX. How would I kill off the three remote sessions?
w
16:45:27 up 8:38, 5 users, load average: 0.65, 0.29, 0.21
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
[code]....
View 4 Replies
View Related
Oct 19, 2010
I am programming on Linux middleware so I need to get a list of all active TCP connections. Is there any API to get such information? I know I can find the connections in /proc/net/tcp, but how to find the PIDs? Apparently ps or netstat command is not an option since it is a middleware.
View 6 Replies
View Related
Feb 11, 2011
I have to write a script that says Hello, [current user]. Today is [date]. The time is [time am/pm]. You have logged into a [term] terminal.My script looks like this:
DOW=`date +%A`
MOY= `date +%B`
DOM= `date +%d`
[code]....
View 1 Replies
View Related
Nov 21, 2010
how can I store the output of (ty to colucix for this line)
Code:
xprop -id $(xprop -root | awk '/_NET_ACTIVE_WINDOW(WINDOW)/{print $NF}') | awk '/_NET_WM_PID(CARDINAL)/{print $NF}'
in a variable and then pass the value of that variable to the kill command as the PID to kill?
View 3 Replies
View Related
Jun 28, 2010
i need C code to get child pids from its parent pid in linux and in kernel mode, is there anything like getpid() or getppid() which works in kernel mode?
View 2 Replies
View Related
Feb 27, 2009
I am looking at ways in which I can restrict the SSH session requests come by specific SSH client (say Putty or NX Client). Is it possible to restrict SSH client login to a client application?
View 8 Replies
View Related
May 3, 2011
I'm trying to call a specific variable based on a user selection. For example:
Code: Select a file:
[1] foo.tar
[2] bar.tar
Enter a selection: I have already coded each possible selection to have its own variable. If the user selects 2 I need to select $SELECTED_TAR2, or if they select 1 I need to select $SELECTED_TAR1 and then do something like this behind the scenes:
Code: cp /home/user/$SELECTED_TAR2 /home/user/backup/$SELECTED_TAR2
I was thinking something like this:
Code: echo "Enter a selection: "
read -e SELECTED_NUMBER
cp /home/user/$SELECTED_TAR$SELECTED_NUMBER /home/user/backup
[code]....
View 2 Replies
View Related
Jul 31, 2010
how to kill all Programs on a specific X display? In example, I need to kill all Programs on Display :1. How is this possible?
View 2 Replies
View Related
Jan 15, 2011
I am trying to write a bash script that would save the current state of my konsole terminals and sessions. I'm using KDE3.X and for some reason the "profile" save does not save the current working directories... Anyway, I would like to know if there is an elegant way to obtain the current workdir of each terminal and session ? I've managed to do something with a clever use of DCOP extended functions, but it requires me to start every konsole with the --script option enabled, and I don't want to do that.
View 9 Replies
View Related
Feb 11, 2011
I have a command that outputs as follows:
# lostjobs
user1 12983 1 0 Feb04 ? 00:00:00 dbr UT:msmenu
user1 18253 1 0 Feb09 ? 00:00:00 dbr UT:msmenu
[code]....
I know I can grab the ones with what I want to kill (which are the ones with question marks) with:
# lostjobs | grep ?
what I need to know is how can I loop through the results of the second one and kill them by id (the second column).
View 2 Replies
View Related
Dec 16, 2009
I thought 'killall' would work, but I need to provide the "command" to kill. I'm really looking for a command that will kill all processes that have a particular file/directory open. Currently, my script fails on an 'umount' because there are several processes that have this filesystem open. The command 'lsof' is a good tool to determine which processes have a filesystem open, but I don't really want to write a script that parses through the 'lsof' output to capture PSIDs. Is there a linux command that can kill all processes that may have a particular filesystem open?
View 2 Replies
View Related
Jun 8, 2010
How do I give permission to a logged in user to stop/start a specific service without entering a root/sudo password? So they can do a simple "service SomeService stop|start" It is for a headless Ubuntu server.
View 5 Replies
View Related
Jun 9, 2010
my system I want user1 and only user1 to be able to mount and unmount a specific partition, this partition contains backups and is usually mounted read only, needs to be temporarily mounted read/write by user1 while doing the backup.user1 is an unprivileged user. I've read that the user option will let any user mount the file-system (and only that user can then subsequently unmount it) and that the users option allows any user to mount or unmount the file-system.I also found this in mount's man pageQuote:The owner option is similar to the user option, with the restriction that the user must be the owner of the special file. This may be useful e.g. for /dev/fd if a login script makes the console user owner of this device. The group option is similar, with the restriction that the user must be member of the group of the special file.So it looks like I'd need a login script for that user to make the user owner of the device file (/dev/voiceserv/backup in this case)
View 7 Replies
View Related
Jul 24, 2010
I need to search a bunch of files in a specific folder for a specific number and add all the numbers together to a total sum. I use Rsync everyday, everytime I run rsync i get a logfile (rsync output) witch contains the textstring "Total bytes sent: xxxxxx".
The "xxxxx" can vary in lenght. I need to extract the "xxxxxx" from each file and add the numbers together to a total size over a week or a month. Is this possible? And I wish to only use bash. One way of doing stuff at a time my friends .
View 5 Replies
View Related
Jul 19, 2010
I want to replace specific character in a file after every specific line. example as follows.
O 000000000000000000
A 111111111111111111
C 222222222222222222
[code]...
View 2 Replies
View Related
Sep 3, 2010
This netbook only has a user with non-administrative privs on it and root user but I do not have root's password.Is there a way that I can create a new administrative user of change the current user's group so that it can do sudo commands or have more privs?
View 1 Replies
View Related
Jun 7, 2011
I was doing some rather lengthy procedures using a terminal. Then I wrote script using Kate, and input it into that terminal, and then realized that I was logged in as a normal user in that terminal as opposed to a superuser, which is how I was logged in at the other terminal. I've never noticed this before because I've never done anything that takes this long.
Is there any way to link all terminal sessions in such a way that they all show me logged in as the same user? I don't even know if this is even important, but I don't want to risk losing any things that I had done.
View 2 Replies
View Related
Apr 16, 2009
while hardening a red hat enterprise 5 installation I have done something that causes the sessions of all user accounts except root to close immediately after authentication. in the /var/log/secure log file it will show three log entries per attempt:
<date/time><hostname> login: pam_unix(login:session): session opened for user fred by LOGIN(uid=0)
<date/time><hostname> login: LOGIN ON tty1 BY fred
<date/time><hostname> login: pam_unix(login:session): session closed for user fred
Since I did a number of things and have not been able to identify what caused this.
View 2 Replies
View Related
Mar 3, 2010
I'm trying to set up automatic recording of user sessions when they login without their knowledge. I tried sticking the script command into /etc/profile and but that didn't really work. I also tried /etc/bashrc but that had the same affect.I have also tried setting the shell in /etc/passwd to SHELL=/bin/bash /usr/bin/script -q /testing.txt.
View 8 Replies
View Related
Jul 22, 2010
is there a way to kill a pts/* or tty* user session from comman line, without knowing its process id.
View 1 Replies
View Related
Nov 18, 2010
All the kill idle user processes scripts I've seen don't take into account that the user might have multiple sessions open. Such is the case with one of our clients. Currently, every hour or two I need to do the following:
This will get the TTY and idle time for all users.
For each idle time over a half hour, I do the following (TTY is the TTY from the previous command with a space.
I then kill those processes.
There must be a way to do this automatically in a bash or perl script. I've tried both, but can't seem to get things to work properly.
View 2 Replies
View Related
Feb 24, 2010
I've three user in my machine ,and i want to make sure that the process created by the user1 can be killed by other user and vice-versa ,is there any way i can do that without using root password or sudo
View 4 Replies
View Related
Jan 10, 2010
I just created a website in PHP and tested on my own webserver. All of my session variables worked great. Today I uploaded it to my commercial server host and it does not remember the session vars from one page to the next. Here is the session section of phpinfo().
Code:
session
Session Support enabled
Registered save handlers files user sqlite
Registered serializer handlers php php_binary wddx
DirectiveLocal ValueMaster Value
session.auto_startOffOff
session.bug_compat_42OnOn
session.bug_compat_warnOnOn
session.cache_expire180180
session.cache_limiternocachenocache
session.cookie_domainno valueno value
session.cookie_httponlyOffOff
session.cookie_lifetime00
session.cookie_path//
session.cookie_secureOffOff
session.entropy_fileno valueno value
session.entropy_length00
session.gc_divisor100100
session.gc_maxlifetime14401440
session.gc_probability11
session.hash_bits_per_character44
session.hash_function00
session.namePHPSESSIDPHPSESSID
session.referer_checkno valueno value
session.save_handlerfilesfiles
session.save_path/tmp/tmp
session.serialize_handlerphpphp
session.use_cookiesOnOn
session.use_only_cookiesOffOff
session.use_trans_sid00
You can see that session.save_path is set to /tmp, which is the default on the shared server. /tmp does exist in my document root directory.
View 3 Replies
View Related
Dec 4, 2010
i googled around and finally stumbled over this forum. I've been wondering, how would i kill an process running from an folder and with user parameter? I usually type this into the ssh console: pkill -9 < process > -U < username >
But i want users be able to run it multiple times, and killing only an specific process and not every single one.
View 4 Replies
View Related
May 5, 2010
I've got a somewhat anemic box, resource-wise, set up in the office where any authorized user plus a guest account can log on. Guest is tightly restricted, but we get a lot of people passing through who need one-time or occasional access - this isn't the big problem. What's causing me problems is that a user will log in, walk away or go to the john and the screen locks. Next user (or this one comes back) and winds up doing another login. At the end of a week or so, I may have a couple of dozen sessions listed when I ask for "users". Since some of these session contain open applications they eat up an awful lot of a marginal amount of available memory. How do I kill the entire session (as root) for a user? Gotta be simple but it's not obvious to me.
View 3 Replies
View Related
May 3, 2010
I need to kill a process which has been started by user2 if I am user1 without being sudoers or using root.Do you know if there is a way of setting that when launching the process? Such as a list of users allowed to kill the process?
View 7 Replies
View Related