09-22-2011
Testing privileges -lock lockfile /var/lock/subsys/..- Permission denied
Hi all,
I have to test some user priviliges. The goal is to be sure that an unauthorized user can't restart some modules (ssh, mysql etc...).
I'm trying to automate it with a shell script but in same cases I got the syslog broadcast message.
Quote:
lockfile /var/lock/subsys/$under_test- Permission denied
Is there any way to simply get a return code (allowed or not) without see the broadcast message on all terminals?
Thanks in advance
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
how can I lock my keyboard while I'm away from the computer without using lock command. What other commands gives me the option to lock keyboard device?
thanks (7 Replies)
Discussion started by: dianayun
7 Replies
2. UNIX for Dummies Questions & Answers
Hi all
I need help finding a process that is continuing to create files in the above area. There are three sub folder titled addr q.local and msg . I have already found a process called mmdf running and have used the kill command to stop this from running. I have also looked for sendmail or... (12 Replies)
Discussion started by: TeaMaker
12 Replies
3. HP-UX
Hi ,
How should i implemet a lock function Hp-ux .
I want to a lock a file through fcntl in Hp-ux .
But is not locking properly .
Thanks
Narendra (7 Replies)
Discussion started by: naren_chella
7 Replies
4. Shell Programming and Scripting
Hi,
My requirement is to service a process and below is the script which i wrote for that and works fine, I have kept it in a crontab and running this everyminute, how do I lock this if its already running and i dont want to open if its running and not completed yet.
The crontab need to run... (4 Replies)
Discussion started by: strunz
4 Replies
5. Shell Programming and Scripting
hi
how can I Lock an account, by prepending ”*LK*” to the password field in /etc/shadow.
I dont want to use passwd -l .
Any idea? (3 Replies)
Discussion started by: tjay83
3 Replies
6. Red Hat
Hello all,
If anyone has time, I have a few questions:
How do I do the following in Linux. We are using Red Hat and Oracle Enterprise Linux, which is based on Red Hat too.
1. How to lock the account after a few (like 3) invalid password attempts?
2. How do you lock a screen after 30... (1 Reply)
Discussion started by: nstarz
1 Replies
7. Red Hat
please tell pre-requisite steps to activate cron. i activated the cron but it not executing the script which i set in crontab entry.through root user i passed the service crond start it get start.but when i go to etc/init.d and passed crond stop command.it gets crond: can't lock /var/run/crond.pid,... (2 Replies)
Discussion started by: umair
2 Replies
8. UNIX for Advanced & Expert Users
I'm not able to view my inbox mails, I'm using Thunderbird.
I have checked the /var/mail/ directory files. There I saw the lock file. .
I have removed the lock file and restarted the Thunderbird, again the lock file is created.
I have changed the file group as mail from users. after that... (1 Reply)
Discussion started by: ungalnanban
1 Replies
9. Linux
Hello
I have simple line of code here:
FILE *lockfp = fopen("/var/lock/subsys/processName", "w");
which is denied even running as root. The result is
locking failed for the following reason: Permission denied
How is this possible? Why is this happening?
Thanks for your... (4 Replies)
Discussion started by: flagman5
4 Replies
10. UNIX for Advanced & Expert Users
I am getting error on redis server on linux 7.5 after change the default path /var/lib/redis to /redisdata, and enable cluster-enabled yes. It would be really appreciate if some one can check and suggest on this issue.
error code:
1240:C 09 Sep 2018 13:53:51.058 # oO0OoO0OoO0Oo Redis is... (3 Replies)
Discussion started by: nadeemrafikhan
3 Replies
LEARN ABOUT SUNOS
touchlock
maillock(3MAIL) User Mailbox Library Functions maillock(3MAIL)
NAME
maillock, mailunlock, touchlock - functions to manage lockfile(s) for user's mailbox
SYNOPSIS
cc [ flag ... ] file ... -lmail [ library ... ]
#include <maillock.h>
int maillock(const char *user, int retrycnt);
void mailunlock(void);
void touchlock(void);
DESCRIPTION
The maillock() function attempts to create a lockfile for the user's mailfile. If a lockfile already exists, and it has not been modified
in the last 5 minutes, maillock() will remove the lockfile and set its own lockfile.
It is crucial that programs locking mail files refresh their locks at least every three minutes to maintain the lock. Refresh the lockfile
by calling the touchlock() function with no arguments.
The algorithm used to determine the age of the lockfile takes into account clock drift between machines using a network file system. A zero
is written into the lockfile so that the lock will be respected by systems running the standard version of System V.
If the lockfile has been modified in the last 5 minutes the process will sleep until the lock is available. The sleep algorithm is to
sleep for 5 seconds times the attempt number. That is, the first sleep will be for 5 seconds, the next sleep will be for 10 seconds, etc.
until the number of attempts reaches retrycnt.
When the lockfile is no longer needed, it should be removed by calling mailunlock().
The user argument is the login name of the user for whose mailbox the lockfile will be created. maillock() assumes that user's mailfiles
are in the ``standard'' place as defined in <maillock.h>.
RETURN VALUES
Upon successful completion, .maillock() returns 0. Otherwise it returns -1.
FILES
/var/mail/* user mailbox files
/var/mail/*.lock user mailbox lockfiles
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO
libmail(3LIB),attributes(5)
NOTES
The mailunlock() function will only remove the lockfile created from the most previous call to maillock(). Calling maillock() for different
users without intervening calls to mailunlock() will cause the initially created lockfile(s) to remain, potentially blocking subsequent
message delivery until the current process finally terminates.
SunOS 5.10 29 Mar 1999 maillock(3MAIL)