Greatest Hits

1666 votes
3 answers
1.8m views
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 ...
627 votes
10 answers
1.8m views
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@...
  • 9,039
776 votes
18 answers
2.6m views
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.
  • 7,885
1279 votes
39 answers
910k views
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 -...
2432 votes
31 answers
513k views
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 ...
  • 23.8k
727 votes
9 answers
937k views
Can scp copy directories recursively?
Currently I can only copy a single .tar file. But how can I copy directories recursively with scp?
  • 7,921
889 votes
14 answers
1.2m views
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 ...
  • 21.8k
529 votes
32 answers
1.0m views
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 ...
457 votes
5 answers
1.1m views
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?
  • 5,951
150 votes
9 answers
1.2m views
Command line to list users in a Windows Active Directory group?
Is there a command line way to list all the users in a particular Active Directory group? I can see who is in the group by going to Manage Computer --> Local User / Groups --> Groups and double ...
305 votes
5 answers
797k views
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 ...
  • 3,153
535 votes
6 answers
453k views
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/ ...
  • 14k
218 votes
5 answers
1.1m views
Can you pass user/pass for HTTP Basic Authentication in URL parameters?
I believe this is not possible, but someone I know insisted that it works. I don't even know what parameters to try, and I haven't found this documented anywhere. I tried http://myserver.com/~user=...
  • 5,530
392 votes
18 answers
244k views
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, ...
  • 4,745
601 votes
16 answers
802k views
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 ...
  • 9,599
265 votes
7 answers
1.2m views
Check if port is open or closed on a Linux server?
How can I check if a port is listening on a Linux server?
370 votes
27 answers
386k views
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 ...
175 votes
8 answers
1.0m views
Resolve host name from IP address
I'm looking for a command line tool which gets an IP address and returns the host name, for Windows.
  • 1,873
180 votes
6 answers
1.2m views
What port does SFTP use?
Does SFTP use port 21 or port 22?
  • 3,731
139 votes
2 answers
849k views
What causes the 'Connection Refused' message?
This is a Canonical Question about Connection Refused We see a lot of questions to the effect When I try to connect to a system I get a message Connection refused Why is this ?
  • 113k
545 votes
11 answers
543k views
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 ^(.*) https://mysite.com$1 ...
  • 8,142
153 votes
5 answers
240k views
What is the difference between authentication and authorization?
Basic question from a novice: What is the difference between authentication and authorization?
332 votes
7 answers
709k views
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 ...
289 votes
14 answers
904k views
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-...
  • 3,025
114 votes
12 answers
956k views
How do I force sync the time on Windows Workstation or Server?
What is the command to sync a Windows workstation or server to its configured time source?
  • 80.9k
233 votes
11 answers
452k views
Docker Container time & timezone (will not reflect changes)
Where do Docker containers get their time information? I've created some containers from the basic ubuntu:trusty image, and when I run it and request 'date', I get UTC time. For awhile I got around ...
  • 2,473
187 votes
11 answers
512k views
"Add correct host key in known_hosts" / multiple ssh host keys per hostname?
Trying to ssh into a computer I control, I'm getting the familiar message: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@...
58 votes
8 answers
593k views
What does "TTL expired in transit" mean on a ping attempt?
We get the message “TTL expired in transit” when we try to ping to a server in a different network segment. When we run tracert, 4 ip addresses repeat themselves indefinitely: 14 60 ms 59 ms ...
  • 685
69 votes
15 answers
563k views
Get list of AD groups a user is a member of
Suppose I have the user id of a user in Active Directory. I'd like to get a list of all AD groups in which that user is currently a member of. How can I do this from the Windows command line? I've ...
  • 1,834
264 votes
5 answers
534k views
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; ...
  • 2,805
343 votes
11 answers
536k views
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 https://gnupg.org * ...
  • 11.9k
266 votes
15 answers
588k views
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 ...
  • 2,923
146 votes
3 answers
187k views
How can I upgrade to Java 1.8 on an Amazon Linux Server?
I tried sudo yum update but it just keeps java "1.7.0_75". I need 1.8 for it to work with another application but can't figure out how to upgrade it. Do I need to manually install it somehow? There's ...
  • 1,463
177 votes
5 answers
586k views
VirtualBox: How to set up networking so both host and guest can access internet and talk to each other
I was wondering if someone could give me a simple guide on how to set up virtual networking in VirtualBox (4.0.2) so that the following scenarios work: Both Host and Guest can access the Internet ...
  • 6,357
25 votes
9 answers
310k views
Span on multiple monitors when logged into a Citrix session via Citrix Receiver (or Citrix server)
I am using the Citrix Receiver in Windows 8, and on Windows XP on another PC. I often log into work from home and am unable to span the session to dual monitors like one can easily do when using "...
  • 1,834
120 votes
4 answers
963k views
How to check if a port is blocked on a Windows machine?
On the Windows platform, what native options to I have to check if a port (3306, for example) on my local machine (as in localhost), is being blocked?
227 votes
17 answers
708k views
Permission denied (publickey). SSH from local Ubuntu to Amazon EC2 server
I have an instance of an application running in the cloud on an Amazon EC2 instance, and I need to connect to it from my local Ubuntu. It works fine on one local ubuntu and also laptop. I got this ...
  • 2,411
192 votes
12 answers
476k views
hosts file ignored, how to troubleshoot?
The hosts file on Windows computers is used to bind certain name strings to specific IP addresses to override other name resolution methods. Often, one decides to change the hosts file, and discovers ...
  • 4,805
90 votes
29 answers
325k views
SSH Suddenly returning Invalid format
So a while ago I set up a server on AWS, and used their generated SSH key. I saved the key to Lastpass, and have successfully retrieved it from there before, and got it working. However, after trying ...
  • 1,003
264 votes
15 answers
458k views
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 ...
90 votes
6 answers
741k views
How to determine the hostname from an IP address in a Windows network?
My LAN has 50 Windows hosts. At the Windows command line I try ping to get the IP address of a running Windows machine. The question is how to get hostname of a specific IP address in the same ...
  • 1,607
27 votes
4 answers
220k views
Outlook 2013: how to reset to "first run" status?
TL;DR Is there a way via script, powershell, reg delete, via telekinesis, whatever to reset Outlook 2013 as if no profiles ever existed and it was running for the first time ever? Still working ...
  • 32.5k
351 votes
6 answers
510k views
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/...
  • 12.8k
102 votes
6 answers
575k views
Windows Server restart / shutdown history
How can I easily see a history of every time my Windows Server has restarted or shutdown and the reason why, including user-initiated, system-initiated, and system crashed? The Windows Event Log is ...
  • 2,414
531 votes
3 answers
271k views
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 ...
  • 5,751
151 votes
2 answers
324k views
What is Active Directory Domain Services and how does it work?
This is a Canonical Question about Active Directory Domain Services (AD DS). What is Active Directory? What does it do and how does it work? How is Active Directory organized: Forest, Child Domain, ...
  • 99.7k
236 votes
7 answers
315k views
How to force or redirect to SSL in nginx?
I have a signup page on a subdomain like: https://signup.example.com It should only be accessible via HTTPS but I'm worried people might somehow stumble upon it via HTTP and get a 404. My html/...
  • 2,685
307 votes
21 answers
458k views
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 ...
246 votes
6 answers
448k views
How can I find out what AD groups I'm a member of?
I'm running a Windows XP desktop in a corporate environment. How can I find out what AD groups I belong to?
  • 3,593
140 votes
9 answers
860k views
What port should I open to allow remote desktop?
What port(s) should I open/NAT to allow me to use Remote Desktop?