All Questions

Filter by
Sorted by
Tagged with
2444 votes
31 answers

Our security auditor is an idiot. How do I give him the information he wants?

A security auditor for our servers has demanded the following within two weeks: A list of current usernames and plain-text passwords for all user accounts on all servers A list of all password ...
user avatar
  • 24k
1704 votes
3 answers

What is a Pem file and how does it differ from other OpenSSL Generated Key File Formats?

I am responsible for maintaining two Debian servers. Every time I have to do anything with security certificates, I Google for tutorials and beat away until it finally works. However, in my searches ...
user avatar
1327 votes
39 answers

How can I sort du -h output by size

I need to get a list of human readable du output. However, du does not have a "sort by size" option, and piping to sort doesn't work with the human readable flag. For example, running: du | sort -...
user avatar
  • 16.5k
912 votes
14 answers

How to determine if a bash variable is empty?

What is the best way to determine if a variable in bash is empty ("")? I have heard that it is recommended that I do if [ "x$variable" = "x" ] Is that the correct way? (there must be something more ...
user avatar
  • 22.1k
789 votes
18 answers

Ping a Specific Port

Just a quick sanity check here. Can you ping a specific port of a machine, and if so, can you provide an example? I'm looking for something like ping ip address portNum.
user avatar
  • 8,015
744 votes
9 answers

Can scp copy directories recursively?

Currently I can only copy a single .tar file. But how can I copy directories recursively with scp?
user avatar
  • 8,121
657 votes
10 answers

How to automate SSH login with password?

How to automate SSH login with password? I'm configuring my test VM, so heavy security is not considered. SSH chosen for acceptable security with minimal configuration. ex) echo password | ssh id@...
user avatar
  • 9,489
623 votes
13 answers

How do I deal with a compromised server?

This is a Canonical Question about Server Security - Responding to Breach Events (Hacking) See Also: Tips for Securing a LAMP Server Reinstall after a Root Compromise? Canonical ...
user avatar
  • 6,330
612 votes
16 answers

How do you find what process is holding a file open in Windows?

One thing that annoys me no end about Windows is the old sharing violation error. Often you can't identify what's holding it open. Usually it's just an editor or explorer just pointing to a relevant ...
user avatar
  • 9,739
550 votes
6 answers

ssh returns "Bad owner or permissions on ~/.ssh/config"

When I try to ssh to another box, I get this strange error $ ssh hostname Bad owner or permissions on ~/.ssh/config But I made sure that I own and have rw permissions on the file: ls -la ~/.ssh/ ...
user avatar
  • 14.3k
549 votes
3 answers

What exactly do the colors in htop status bars mean?

By default, htop shows colored status bars for processors, memory, and swap. From left to right, the bars are colored green, blue, yellow, and red depending on some thresholds. What does it mean when ...
user avatar
  • 5,931
546 votes
11 answers

In Nginx, how can I rewrite all http requests to https while maintaining sub-domain?

I want to rewrite all http requests on my web server to be https requests, I started with the following: server { listen 80; location / { rewrite ^(.*)$1 ...
user avatar
  • 8,222
538 votes
32 answers

How do I tell Git for Windows where to find my private RSA key?

My Git setup runs fine on Linux, but when I try to set things up under Windows (using Git for Windows and TortoiseGit), I don't know where to put my private SSH key (or, better still, how to tell ssh ...
user avatar
520 votes
5 answers

What is the difference between double and single square brackets in bash?

I just wondered what exactly the difference between [[ $STRING != foo ]] and [ $STRING != foo ] is, apart from that the latter is POSIX-compliant, found in sh and the former is an extension found in ...
user avatar
  • 6,195
469 votes
8 answers

How does IPv4 Subnetting Work?

This is a Canonical Question about IPv4 Subnets. Related: How does IPv6 subnetting work and how does it differ from IPv4 subnetting? How does Subnetting Work, and How do you do it by ...
466 votes
7 answers

Something is burning in the server room; how can I quickly identify what it is?

The other day, we notice a terrible burning smell coming out of the server room. Long story short, it ended up being one of the battery modules that was burning up in the UPS unit, but it took a good ...
user avatar
462 votes
5 answers

What's the default superuser username/password for postgres after a new install?

I have just installed postgres 8.4 on Ubuntu 9.10 and it has never asked me to create a superuser. Is there a default superuser and its password? If not, how do I create a new one?
user avatar
  • 6,001
417 votes
19 answers

mysqldump throws: Unknown table 'COLUMN_STATISTICS' in information_schema (1109)

Every time I try to make a mysqldump I get the following error: $> mysqldump --single-transaction --host host -u user -p db > db.sql mysqldump: Couldn't execute 'SELECT COLUMN_NAME, ...
user avatar
  • 5,067
394 votes
3 answers

How do I change my private key passphrase?

I have an existing public/private key pair. The private key is password protected, and the encryption may be either RSA or DSA. These keys are the kind you generate with ssh-keygen and generally store ...
user avatar
  • 4,412
386 votes
20 answers

How to run a server on port 80 as a normal user on Linux?

I have Googled about a solution for quite some time, but couldn't find an answer. I am on Ubuntu Linux and want to run a server on port 80, but due to security mechanism of Ubuntu, I get the ...
user avatar
377 votes
27 answers

How can I get the size of an Amazon S3 bucket?

I'd like to graph the size (in bytes, and # of items) of an Amazon S3 bucket and am looking for an efficient way to get the data. The s3cmd tools provide a way to get the total file size using s3cmd ...
user avatar
377 votes
21 answers

How do you search for backdoors from the previous IT person?

We all know it happens. A bitter old IT guy leaves a backdoor into the system and network in order to have fun with the new guys and show the company how bad things are without him. I've never ...
user avatar
  • 18.9k
368 votes
13 answers

Displaying a remote SSL certificate details using CLI tools

In Chrome, clicking on the green HTTPS lock icon opens a window with the certificate details: When I tried the same with cURL, I got only some of the information: $ curl -vvI * ...
user avatar
  • 12.3k
363 votes
5 answers

Anyone else experiencing high rates of Linux server crashes during a leap second day?

*NOTE: if your server still has issues due to confused kernels, and you can't reboot - the simplest solution proposed with gnu date installed on your system is: date -s now. This will reset the ...
user avatar
356 votes
6 answers

What permissions should my website files/folders have on a Linux webserver?

This is a Canonical Question about File Permissions on a Linux web server. I have a Linux web server running Apache2 that hosts several websites. Each website has its own folder in /var/www/. /var/...
user avatar
  • 13k
353 votes
7 answers

Why is my crontab not working, and how can I troubleshoot it?

This is a Canonical Question about using cron & crontab. You have been directed here because the community is fairly sure that the answer to your question can be found below. If your question is ...
user avatar
344 votes
19 answers

Showing total progress in rsync: is it possible?

I have searched for this option already, but have only found solutions that involve custom patching. The fact that it does not show in --help and no more info can be found probably indicates the ...
user avatar
331 votes
19 answers

How do I get the current Unix time in milliseconds in Bash?

How do I get the current Unix time in milliseconds (i.e number of milliseconds since Unix epoch January 1 1970)?
user avatar
  • 3,592
328 votes
18 answers

Copying a large directory tree locally? cp or rsync?

I have to copy a large directory tree, about 1.8 TB. It's all local. Out of habit I'd use rsync, however I wonder if there's much point, and if I should rather use cp. I'm worried about permissions ...
user avatar
327 votes
23 answers

How can I use environment variables in Nginx.conf

I have a docker container running Nginx, that links to another docker container. The host name and IP address of the second container is loaded into the Nginx container as environment variables on ...
user avatar
319 votes
27 answers

100% uptime for a web application

We received an interesting "requirement" from a client today. They want 100% uptime with off-site failover on a web application. From our web application's viewpoint, this isn't an issue. It was ...
user avatar
  • 3,762
318 votes
5 answers

How to send ctrl+alt+del using Remote Desktop?

How can I send ctrl+alt+del to a remote computer over Remote Desktop? For example, if I wanted to change the local admin password on a remote PC using a Remote Desktop connection, it would be helpful ...
user avatar
  • 3,283
316 votes
4 answers

What are the functional differences between .profile .bash_profile and .bashrc

What are the functional differences between the .profile, .bash_profile and .bashrc files?
user avatar
313 votes
24 answers

Can I automatically add a new host to known_hosts?

Here's my situation: I'm setting up a test harness that will, from a central client, launch a number of virtual machine instances and then execute commands on them via ssh. The virtual machines will ...
user avatar
305 votes
5 answers

How to set environment variable in systemd service?

I have an Arch Linux system with systemd and I've created my own service. The configuration service at /etc/systemd/system/myservice.service looks like this: [Unit] Description=My Daemon [Service] ...
user avatar
  • 3,153
303 votes
8 answers

How to bind MySQL server to more than one IP address?

Is there a secret way to bind MySQL to more than one IP address? As far as I can see the bind-address parameter in the my.cnf does not support more than one IP and you can't have it more than once.
user avatar
  • 3,766
295 votes
14 answers

What's the command-line utility in Windows to do a reverse DNS look-up?

Is there a built-in command line tool that will do reverse DNS look-ups in Windows? I.e., something like <toolname> w.x.y.z => mycomputername I've tried: nslookup: seems to be forward look-...
user avatar
  • 3,085
293 votes
4 answers

How do I select which Apache MPM to use?

This is a Canonical Question about selecting the right Apache httpd MPM. I'm a little confused between the different MPMs offered by Apache - 'worker', 'event', 'prefork', etc. What are the major ...
user avatar
281 votes
160 answers

Useful Command-line Commands on Windows

The aim for this Wiki is to promote using a command to open up commonly used applications without having to go through many mouse clicks - thus saving time on monitoring and troubleshooting Windows ...
281 votes
4 answers

Why do I need Nginx and something like Gunicorn?

I'm looking for an overly simplified answer to the following question. I'm trying to build a foundational understanding of how Nginx works alongside something like Gunicorn. Do I need both Nginx and ...
user avatar
  • 2,915
280 votes
13 answers

Can I nohup/screen an already-started process?

I'm doing some test-runs of long-running data migration scripts, over SSH. Let's say I start running a script around 4 PM; now, 6 PM rolls around, and I'm cursing myself for not doing this all in ...
user avatar
  • 2,903
279 votes
5 answers

Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About mod_rewrite Rules but Were Afraid to Ask

This is a Canonical Question about Apache's mod_rewrite. Changing a request URL or redirecting users to a different URL than the one they originally requested is done using mod_rewrite. This includes ...
user avatar
  • 81.6k
278 votes
45 answers

What are the obstacles to providing reliable Internet access and Wi-Fi at large tech conferences? [closed]

Every tech conference I've ever been to, and I've been to a lot, has had absolutely abysmal Wi-Fi and Internet access. Sometimes it's the DHCP server running out of addresses. Sometimes the backhaul ...
user avatar
  • 3,686
276 votes
5 answers

Nginx reverse proxy + URL rewrite

Nginx is running on port 80, and I'm using it to reverse proxy URLs with path /foo to port 3200 this way: location /foo { proxy_pass http://localhost:3200; ...
user avatar
  • 2,925
275 votes
15 answers

How to Unban an IP properly with Fail2Ban

I'm using Fail2Ban on a server and I'm wondering how to unban an IP properly. I know I can work with IPTables directly: iptables -D fail2ban-ssh <number> But is there not a way to do it with ...
user avatar
  • 3,013
275 votes
7 answers

Check if port is open or closed on a Linux server?

How can I check if a port is listening on a Linux server?
user avatar
272 votes
5 answers

What's the difference between IP address and

I know that ~ are the loopback IP addresses for most modern operating systems, and these IP addresses can be used to refer to our own computer. But what's It seems ...
user avatar
  • 2,907
272 votes
6 answers

How to assign permissions to ApplicationPoolIdentity account

In IIS 7 on Windows Server 2008, application pools can be run as the "ApplicationPoolIdentity" account instead of the NetworkService account. How do I assign permissions to this "...
user avatar
  • 3,398
270 votes
15 answers

Finding out what user Apache is running as?

I want to secure a file upload directory on my server as described beautifully here, but I have one problem before I can follow these instructions. I don't know what user Apache is running as. I've ...
user avatar
268 votes
15 answers

I've inherited a rat's nest of cabling. What now?

You know, you see pictures like below and sort of chuckle until you actually have to deal with it. I have just inherited something that looks like the picture below. The culture of the organization ...
user avatar

15 30 50 per page
2 3 4 5