Re: [F23] cannot unlock a user with passwd - invalid shadow.lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/04/2015 05:29 AM, Frédéric Bron wrote:
in fact, I just had to delete the .lock file. I do not understand why
it was there.

Many commands create a lock file so that you can't run multiple copies
of the command simultaneously. If you had two users running that
command, both writing to the shadow file, you could easily corrupt it.

The downside to lockfiles is if you interrupt the command somehow
(CTRL-C, sigint, whatever), it may terminate without cleaning up its
lock file first (poor programming, but it often happens). Future runs
of the command are denied because the lock file is present and the
command assumes another copy of itself is already running.

Example in shell script:

    if [ -e /tmp/lockfile ]; then
	echo "Lockfile found, exiting"
	exit 1
    fi

    touch /tmp/lockfile
    (do stuff)
    rm -f /tmp/lockfile
    exit 0

To make sure the lockfile gets deleted, you must create a function
that deletes the lockfile, and specify that function in a trap call
to trap SIGINT, SIGTERM, etc. That way it cleans up after itself if
you abort it.

You get the idea.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ricks@xxxxxxxxxxxxxx -
- AIM/Skype: therps2        ICQ: 226437340           Yahoo: origrps2 -
-                                                                    -
-     Try to look unimportant.  The bad guys may be low on ammo.     -
----------------------------------------------------------------------
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux