Tag Info

Hot answers tagged

43

There's probably an easier way, but I do this: See who's logged into your machine -- use who or w: > who mmrozek tty1 Aug 17 10:03 mmrozek pts/3 Aug 17 10:09 (:pts/2:S.0) Look up the process ID of the shell their TTY is connected to: > ps t PID TTY STAT TIME COMMAND 30737 pts/3 Ss 0:00 zsh Laugh at their ...


27

For the same reasons why each daemon should have minimal rights. Apache can run as root. It is designed to perform one task and surely nothing bad can happen? But assume apache is not bug-free. Bugs are discovered from time to time. Sometimes it can even be arbitrary code execution or similar. Now with apache running as root, it can access anything — for ...


18

Add the user to the wheel group: gpasswd wheel -a username I use gpasswd because not all versions of usermod have an easy way to add the user to a group without changing all the users' groups. However, on any recent Fedora, usermod username -a -G wheel should have the same effect. You could also use the system-config-users GUI, of course. If you are ...


17

The harsh truth is that nothing can protect you from your own stupidity. There's no DWIM (do what I mean) interface. The computer can't tell the difference between what is intentional and what is accidental. No matter how much abstraction you pile on the wrong stray command can destroy it all. The simple answer is to slow down and pay attention to what ...


13

To avoid a mistaken rm -rf, do not type rm -rf. If you need to delete a directory tree, I recommend the following workflow: If necessary, change to the parent of the directory you want to delete. mv directory-to-delete DELETE Explore DELETE and check that it is indeed what you wanted to delete rm -rf DELETE Never call rm -rf with an argument other than ...


10

Apart from the obvious point of security, it is clear you've never hosed your system by mistyping a command in the shell or a lapsus. If it happens, you'll understand why people freak out about it. And then you will cry in horror, and also realize that it was a highly educational experience, but you're not getting your system back anyway. A thought: if ...


9

The kernel documentation provides a general coverage of cgroups with examples. The cgroups-bin package (which depends on libcgroup1) already provided by the distribution should be fine. Configuration is done by editing the following two files: /etc/cgconfig.conf Used by libcgroup to define control groups, their parameters and mount points. ...


9

"A package manager is working" means that something is holding a lock on /var/lib/dpkg/lock and/or/var /cache/apt/archives/lock. You can find out which process this is with the fuser command: dennis@lightning:~$ sudo fuser /var/lib/dpkg/lock /var/cache/apt/archives/lock /var/lib/dpkg/lock: 18049 /var/cache/apt/archives/lock: 18049 dennis@lightning:~$ cat ...


8

Matt's answer is quite correct but misses the historical context that when UNIX systems were first brought into larger data centers "operator" was usually the actual job title for the staff performing simple routine tasks on the systems.


8

It depends what exactly you need and what you are looking for. But in general there exists multiple solutions for configuration management like: puppet chef cfengine3 etc. I personally would recommend puppet as it has a big community and a lot of external provided recipes. This allows you to configure and manage systems automatically. If you combine this ...


7

The concept of operators origins from the second generation of computers. Back at that time, programmers used to write code on punch cards, then deliver the cards to an operator - professional staff with access to the insanely expensive mainframe machine. The operator was responsible for putting the cards on the machine for execution. When the execution was ...


6

You can't use crontab like that. Use man crontab to read about the correct way of calling this utility. You'll want to use crontab -e to edit the current user's cron entries (you can add/modify/remove lines). Use crontab -l to see the current list of configured tasks. As for seeing other user's crontabs, that's not possible without being root on default ...


6

You should understand how to use common(ish) unix tools. vim may have changed between redhat 4 and redhat 300, but I bet you vi is the same (even if they are using vim as a replacement for vi, the vi commands will work as expected). The package tools may not be familiar to you, but I bet you can still download a tgz file, ./configure, make, sudo make ...


6

The usermod command will allow you to change a user's primary group, supplementary group or a number of other attributes. The -g switch controls the primary group. For your other questions... 1 - If you specify a group, groupname, that does not exist during the useradd stage, you will receive an error - useradd: unknown group groupname 2 - The groupadd ...


6

If you run man ps then type /SpaceShift+CSpaceEnter, you should see this line. C pcpu cpu utilization but that's under the OBSOLETE SORT KEYS header, so is not what we're looking for. Press n to find the next match: c C processor utilization. Currently, this is the integer value of the percent ...


5

Enter "you damn kids" mode. Your tools should help you do your job more efficiently, without preventing you from understanding what is going on. Really, RH 4 is not that old, and mostly similar to what is around today. It might not have the latest and greatest, but should be sufficient to do what you need (what is it that you need). Rant over. On ...


5

I know a solution, but it requires 'root' privilege sadly. Anyway, you might still found it usefull: sudo lshw -class disk -class storage For each device it will print the logical name (e.g. /dev/sda) and bus info which in case of USB device would be something like 'usb@1:2'. Sample output: [...] *-storage description: SATA controller ...


5

There are a few ways to tell without root privileges, many of them tricky/hacky: Using /dev/disk/by-id: find /dev/disk/by-id/ -lname '*sdX' If this responds with something like /dev/disk/by-id/usb-blah-blah-blah, then it's a USB disk. Other prefixes include ata, dm, memstick, scsi, etc. Using /dev/disk/by-path isn't significantly different: find ...


4

The Unix Rosetta Stone is a good resource for this kind of questions. It mentions a few alternatives for lsof (see below). Do not however that lsof is the de facto standard application for what it does. If all you want is to find the process ID(s) that have a particular file open, then you can use fuser on any POSIX-compliant system. On operating systems ...


4

The Linux Advanced Routing & Traffic Control HOWTO has a section describing to solve the problem. The key step to balance traffic between the two routes is to give them both a weight. ip route add default scope global \ nexthop via 192.168.0.1 dev eth1 weight 1 \ nexthop via 192.168.1.1 dev eth0 weight 1


4

The practice is not to create one user and group per application, but per service. That is, programs that are executed by a local user don't need to be installed as a user other than root. It's daemons, programs running in the background and that execute requests coming through the network or other communication means, that should run as a dedicated user. ...


3

http://sathyasays.com/2008/05/27/enabling-and-disabling-root-account-in-debianubuntu/ Basically, you just make sure the 'sudoers' file allows anybody in the 'admin' group (or whatever group you want) to execute files using 'sudo': %admin ALL=(ALL) Then you disable the 'root' account password with: passwd -d root This should work with openSUSE too.


3

First off, don't expect this is going to be easy working with multiple distributions. I've not run large desktop rollouts. For me the best tradeoff was using a LAN boot/tftp to bootstrap the system then running the install over NFS. Most Linux distro's ask you for all the initial config up front - then you can leave the installer to run for, say 40 minutes, ...


3

No, it's not overrated. In practice it's most under-appreciated. :-) My small team at work for example is sharing an RHEL machine for development work: building stuff, testing etc. Everyone uses individual user accounts, but we also share the root password since people need this time to time for quick sysadmin tasks. This also has resulted in us managing ...


3

Picking up on a comment of yours to another answer but linux is about freedom, including freedom to destroy your own data, privacy and security Even forcing people through sudo, Linux offers this freedom. The whole security argument that you want to shun is there to protect you from things are aren't you (read: malicious programs or programs controlled ...


3

If you're on Linux you can : Mount your root filesystem on a random mountpoint. I usually use /mnt for this sort of things. mount --bind / /mnt Then you can (re)move the files from /mnt/var Not all OS's allow a filesystem mounted on a second mount point at the same time, that's why I wrote 'on Linux'. Just try the mount, it won't break anything.


3

One of the best books for learning in depth about Linux is a book called Rute. It is fairly old (last ed. 2001), but is still very useful, although by now some distros will use different systems (e.g. Upstart in Ubuntu): Rute Another excellent book is the Debian handbook, which is very useful if you are using Debian or Debian based systems: Debian ...


3

crontab can be used to override the files that are used by default. As such you can remove and add your own cron lists, or just single cron jobs. crontab -l That will list the cron jobs/lists/tabs that are currently initialized, their frequency, directory and file location, and a few other small details. Also in FreeBSD you can look in /var/cron/tabs and ...


3

You can use chpasswd to do it, like this: echo "username:newpassword" | chpasswd You can pipe into chpasswd from programs other than echo, if convenient, but this will do the trick. Edit: To generate the password within the shell script and then set it, you can do something like this: # Change username to the correct user: USR=username # This will ...


3

If you are using rm * and the zsh, you can set the option rmstarwait: setopt rmstarwait Now the shell warns when you're using the *: > zsh -f > setopt rmstarwait > touch a b c > rm * zsh: sure you want to delete all the files in /home/unixuser [yn]? _ When you reject it (n), nothing happens. Otherwise all files will be deleted.



Only top voted, non community-wiki answers of a minimum length are eligible