Most Popular

1500 questions
69
votes
3 answers

Permit root to login via ssh only with key-based authentication

I have some doubts about certain ssh server configurations on /etc/ssh/sshd_config. I want the next behavior: Public key authentication is the only way to authenticate as root (no password authentication or other) Normal users can use both…
mavillan
  • 2,967
  • 4
  • 21
  • 27
69
votes
8 answers

How to allow non-superusers to mount any filesystem?

Is it possible to allow some particular users (e.g. members of a group) to mount any filesystem without superuser privileges on Linux? Another question might have been "in what ways a user can harm a system by mounting filesystems?"
user27225
69
votes
5 answers

Show PATH in a human-readable way

I want to show my PATH environment variable in a more human-readable way. $ echo…
Arturo Herrero
  • 2,246
  • 2
  • 19
  • 17
69
votes
4 answers

List all files with the same inode number?

Let's say when I do ls -li inside a directory, I get this: 12353538 -rw-r--r-- 6 me me 1650 2013-01-10 16:33 fun.txt As the output shows, the file fun.txt has 6 hard links; and the inode number is 12353538. How do I find all the hard links for the…
its_me
  • 13,229
  • 21
  • 53
  • 52
69
votes
2 answers

What do the bash-builtins 'set' and 'export' do?

I am at a bit of a loss as to the purpose of set and export in Bash (and I guess probably other shells too). I would think it is for setting environment variables, but that can be done just with VARIABLE=VALUE, right? Also typing set and export on…
mydoghasworms
  • 1,351
  • 1
  • 12
  • 19
69
votes
2 answers

command to zip multiple directories into individual zip files

I have a single directory that contains dozens of directories inside of it. I'm new to command line and I'm struggling to come up with a command that will zip each sub-directory into a unique sub-directory.zip file. So in the end my primary…
Evster
  • 1,555
  • 2
  • 12
  • 11
69
votes
3 answers

Shebang line with `#!/usr/bin/env command --argument` fails on Linux

I've got a simple script: #!/usr/bin/env ruby --verbose # script.rb puts "hi" On my OSX box, it runs fine: osx% ./script.rb hi However, on my linux box, it throws an error linux% ./script.rb /usr/bin/env: ruby --verbose: No such file or…
rampion
  • 1,481
  • 1
  • 10
  • 13
69
votes
5 answers

How can I tell what version of OS X I'm on from the command line?

I frequently find myself SSHing into various OS X machines, and it'd be useful if I could tell what version of OS X I was on when I'm doing that. uname -a doesn't quite work, since Darwin kernel versions don't always change with the rest of the…
Benjamin Pollack
  • 985
  • 1
  • 7
  • 11
69
votes
4 answers

Why would anyone choose not to use the lowlatency kernel?

I can't find any good information on the rt and lowlatency Linux kernels. I am wondering why anybody would not want to use a lowlatency kernel. Also, if anyone can tell what the specific differences are, that would be great too.
Startec
  • 1,609
  • 3
  • 22
  • 25
69
votes
7 answers

Program that passes STDIN to STDOUT with color codes stripped?

I have a command that produces output in color, and I would like to pipe it into a file with the color codes stripped out. Is there a command that works like cat except that it strips color codes? I plan to do something like this: $…
Ryan C. Thompson
  • 5,228
  • 6
  • 28
  • 23
69
votes
2 answers

Find any lines exceeding a certain length

Is it possible to find any lines in a file that exceed 79 characters?
rowantran
  • 1,735
  • 2
  • 12
  • 7
69
votes
11 answers

Terminating an infinite loop

I have a command that I want to have run again automatically each time it terminates, so I ran something like this: while [ 1 ]; do COMMAND; done; but if I can't stop the loop with Ctrl-c as that just kills COMMAND and not the entire loop. How…
howardh
  • 1,232
  • 1
  • 11
  • 16
69
votes
6 answers

Will a Linux executable compiled on one "flavor" of Linux run on a different one?

Will the executable of a small, extremely simple program, such as the one shown below, that is compiled on one flavor of Linux run on a different flavor? Or would it need to be recompiled? Does machine architecture matter in a case such as this? int…
JCDeen
  • 765
  • 1
  • 5
  • 9
69
votes
3 answers

Unable to delete file, even when running as root

I am in the process of migrating a machine from RHEL 4 to 5. Rather than actually do an upgrade we have created a new VM (both machines are in a cloud) and I am in the process of copying across data between the two. I have come across the following…
Rich
  • 4,269
  • 9
  • 31
  • 32
69
votes
6 answers

Why does reboot and poweroff require root privileges?

To restart or shut off Linux from the terminal, one can use reboot and poweroff, respectively. However, both of these commands require root privileges. Why is this so? What security risk is posed by not requiring this to have root privileges? The…
Rohan
  • 3,241
  • 9
  • 27
  • 43
1 2 3
99
100