summaryrefslogtreecommitdiffstats
path: root/sys-utils
Commit message (Collapse)AuthorAgeFilesLines
* textual: gettextize several overlooked messagesBenno Schulenberg2013-01-251-1/+1
| | | | | | Also improve the clarity of some of them. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: remove inconsistent periods from two error messagesBenno Schulenberg2013-01-251-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* dmesg: parse level when --color is usedSami Kerola2013-01-251-1/+1
| | | | | | | When user runs with --color it should not need to be combined with filtering per level or facility, or decoding. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: add boundary check to facility & level array usageSami Kerola2013-01-251-1/+3
| | | | | | | The dmesg should not crash while --decode'ing message facilities and levels to readable string even if the values are out of bounds. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcmk: use random_get_bytes() to generate IPC keysKarel Zak2013-01-241-11/+10Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* nsenter: improve optional args in usage() and man pageKarel Zak2013-01-172-19/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* unshare,nsenter: Move the old libc handling into a common header namespace.hEric W. Biederman2013-01-172-55/+2Star
| | | | | | | | | | | | | | Move the defitions of CLONE_NEWNS, CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWUSER, CLONE_NEWPID into namespace.h in case sched.h does not provide those definitions. Are there systems around that are old enough that still need this? Move the definitions of unshare() and setns() into namespace.h for supporting old versions of libc that does not provice these. I have tested this support with setns as I still have systems old enough that glibc does not wrap setns. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
* nsenter: Replace a bare strtoul with strtoul_or_errEric W. Biederman2013-01-171-8/+2Star
| | | | | | | This is shorter code and makes things a bit clearer and less error prone if anyone happens to copy the code. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
* nsenter: Add const to declarations where possible.Eric W. Biederman2013-01-171-3/+3
| | | | | | Make it clear where functions do not modify their arguments. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
* nsenter: Properly spell significant in a comment.Eric W. Biederman2013-01-171-1/+1
| | | | Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
* nsenter: Enhance waiting for a child processEric W. Biederman2013-01-171-13/+35
| | | | | | | | | | | | | | | | | | | | | | In the case of a pid namespace we need to fork a child process instead of calling exec. Move all of that logic out of line into a function continue_as_child, making the logic of the primary case easier to understand. Update the logic for waiting for a child process to suspend ourselves when the child processes suspends and to continue the child process when we are unsuspsended. This supports the bash suspend command and various editors that suspend themselves. If the child process exits with a signal update the logic to run kill(getpid(), WTERMSIG(status)) so the caller sees the same exit code that nsenter observed. There will always be permission to send signals to our children and the tty is not changing so there is no need for the intermediate process to forward signals to it's child. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
* unshare: Add support for the pid and user namespacesEric W. Biederman2013-01-172-13/+33
| | | | | | | | | | | | - Update the unshare application to support the pid and user namespaces. - Update the man page for the new options - Fix typo in the man page where UTS was spelled UTC. - Remove the vestigal support for running a suid unshare. After unsharing a user namespace setuid(getuid()) won't work because no uid or gid mappings have been specified yet. So it is just easier not to have any support for running suid. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
* nsenter: new command (light wrapper around setns)Eric W. Biederman2013-01-173-0/+394
| | | | | | | | | | | Inspired by unshare, nsenter is a simple wrapper around setns that allows running a new process in the context of an existing process. Full paths may be specified to the namespace arguments so that namespace file descriptors may be used wherever they reside in the filesystem. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
* Revert "unshare: support the switching of namespaces"Karel Zak2013-01-173-83/+29Star
| | | | | | | The functionality will be replaced with nsenter from Eric W. Biederman. This reverts commit 4bbe8099390d528018890efa914e268de3c4b44b.
* mount: make --verbose more verbose about propagationKarel Zak2013-01-151-2/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: write success messages to stdoutKarel Zak2013-01-151-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: support multiple MS_PROPAGATION flags in one mount(8) execKarel Zak2013-01-152-33/+75
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: add support for x-mount.mkdir[=<mode>] optionOndrej Oprala2013-01-091-0/+7
| | | | | | | | | If the target directory (mountpoint) does not exist then mount(8) will create it before mount.<type> is executed or mount(2) syscall is called. Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: document x-* optionsKarel Zak2013-01-091-0/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: Fix -t in listing mode when run as non-rootRichard Tollerton2013-01-091-1/+6
| | | | | | | | | | | Presently, libmount-mount completely prohibits the use of -t by non-root users. This breaks using -t in listing mode as a user, which represents a regression against mount-deprecated, macosx and presumably *BSD. This commit fixes the issue by deferring the mnt_context_is_restricted check for -t until we know we're not in listing mode. Signed-off-by: Rich Tollerton <rich.tollerton@ni.com>
* mount: document options for debugfsDave Reisner2013-01-091-2/+7
| | | | | | Since 3.4, debugfs allows uid, gid, and mode options. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* losetup: fix declarations [smatch scan]Sami Kerola2013-01-091-2/+5
| | | | | | | sys-utils/losetup.c:309:2: error: 'for' loop initial declarations are only allowed in C99 mode sys-utils/losetup.c:374:2: error: 'for' loop initial declarations are only allowed in C99 mode Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swapon: default to --show if nothing is requestedSami Kerola2013-01-091-4/+1Star
| | | | | | Proposed-by: Karel Zak <kzak@redhat.com> References: http://www.spinics.net/lists/util-linux-ng/msg07301.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: fix spacing in summary outputSami Kerola2013-01-091-1/+1
| | | | | | Change 56692a6 introduced spacing error to --summary printing. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* flock: improve usage stringsMike Frysinger2013-01-092-5/+16
| | | | | | | | The current examples miss the best usage of all: specifying the command and its arguments directly on the command line. Add that to both the program usage and the man page. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* swapon: print warning about insecure owner/permissionsKarel Zak2013-01-081-10/+6Star
| | | | | | | | | Let's make it more obvious if swap area is accessible for non-root users. The old version prints the warning only if --verbose is specified. Reported-by: mp.lists@free.fr Signed-off-by: Karel Zak <kzak@redhat.com>
* unshare: support the switching of namespacesNeil Horman2013-01-073-29/+83
| | | | | | | | | | | | | | | | | | | | | In addition to the unshare syscall, there exists the setns syscall, which allows processes to migrate to the namepsaces of other processes. Add this functionality into the unshare command, as they operate in a fairly simmilar fashion. Note: There was discussion of adding a path based namespace argument to unshare in the origional discussion thread, but I opted to leave that out as it didn't seem to fit in nicely with the current argument pattern. I figure we can always add that in later if we need to [kzak@redhat.com: - fix optional arguments - do not call unshare if no flag specified - use O_CLOEXEC - codding style cleanup] Signed-off-by: Neil Horman <nhorman@tuxdriver.com> CC: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: fix compiler warnings, use 64bit timeKarel Zak2012-12-203-31/+36
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: fix compiler warningKarel Zak2012-12-201-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: make --human really sexyKarel Zak2012-12-191-2/+12
| | | | | | Align the "size" columns to the right. Signed-off-by: Karel Zak <kzak@redhat.com>
* tunelp: deprecation: remove command from default buildSami Kerola2012-12-191-0/+2
| | | | | | It is difficult to think think tunelp command being in use a lot. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: add --bytes size output optionSami Kerola2012-12-192-1/+9
| | | | | | | | This makes the command being a little closer standard compliant. See IEEE Std 1003.1 referral link below for more information. References: http://pubs.opengroup.org/onlinepubs/009696799/utilities/ipcs.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: add --human readable size conversion optionSami Kerola2012-12-194-34/+106
| | | | | | | | | Introduces new function ipc_print_size() which will call size_to_human_string(), and handles the occasional '([k]bytes)' printing if default size format is requested. Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: assist debuggingSami Kerola2012-12-191-6/+9
| | | | | | | One will be able to see enum symbols when debugging, which is not the case when values are specified as define list. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: swapon.8 option name fixSami Kerola2012-12-191-1/+1
| | | | | | | The commit 7ae8b469adda598fda28e4ea647d47905b43e172 added option --bytes, not the initial proposal which was changed after maillist discussion. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swapon: fix memmory leak [coverity scan]Karel Zak2012-12-121-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: don't care about xasprintf() return codeKarel Zak2012-12-121-7/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* prlimit: don't care about xasprintf() return codeKarel Zak2012-12-121-8/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: don't care about xasprintf() return codeKarel Zak2012-12-121-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: sanitize paths from non-root usersKarel Zak2012-11-261-2/+30
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: sanitize paths from non-root usersKarel Zak2012-11-261-0/+35
| | | | | | | | | | | | | | | | | | | | | | $ mount /root/.ssh/../../dev/sda2 mount: only root can mount UUID=17bc65ec-4125-4e7c-8a7d-e2795064c736 on /boot this is too promiscuous. It seems better to ignore on command line specified paths which are not resolve-able for non-root users. Fixed version: $ mount /root/.ssh/../../dev/sda2 mount: /root/.ssh/../../dev/sda2: Permission denied $ mount /dev/sda2 mount: only root can mount UUID=17bc65ec-4125-4e7c-8a7d-e2795064c736 on /boot Note that this bug has no relation to mount(2) permissions evaluation in suid mode. The way how non-root user specifies paths on command line is completely irrelevant for comparison with fstab entries. Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: remove unnecessary variableKarel Zak2012-11-231-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: remove print_perms()Sami Kerola2012-11-231-26/+0Star
| | | | | | The function is no longer in use. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: make individual message queue id printing to use /procSami Kerola2012-11-232-26/+32
| | | | | | | | [kzak@redhat.com: - fix msgctl() call, move q_qbytes to ipc_msg_get_info] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: clean up do_msg(), and add ipc_msg_get_info()Sami Kerola2012-11-233-45/+178
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: make individual semaphore id printing to use /procSami Kerola2012-11-233-36/+72
| | | | | | | | | And reindent the print_shm() function. [kzak@redhat.com: move semctl(GET*...) calls to ipcutils.c] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: clean up do_sem(), and add ipc_sem_get_info()Sami Kerola2012-11-233-40/+164
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs: make individual shared memory id printing to use /procSami Kerola2012-11-231-21/+24
| | | | | | | And reindent the print_shm() function. Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: fix ipc_shm_get_info(), use callocKarel Zak2012-11-231-11/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: clean up do_shm()Karel Zak2012-11-233-14/+34
| | | | | | | | - don't expect maxid as argument in ipc_shm_get_info() - if there is @id argument then use it everywhere in ipc_shm_get_info() - don't call shmctl() if not necessary in do_shm() Signed-off-by: Karel Zak <kzak@redhat.com>