Greatest Hits

748 votes
8 answers
2.4m 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@...
Eonil's user avatar
  • 10.6k
1820 votes
3 answers
2.2m 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 ...
Noah Goodrich's user avatar
814 votes
18 answers
2.9m 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.
Davie's user avatar
  • 8,265
1442 votes
39 answers
1.2m 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 -...
Tom Feiner's user avatar
  • 17.8k
791 votes
9 answers
1.1m views

Can scp copy directories recursively?

Currently I can only copy a single .tar file. But how can I copy directories recursively with scp?
kernel's user avatar
  • 8,671
1010 votes
15 answers
1.4m 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 ...
Brent 's user avatar
  • 23.2k
2491 votes
31 answers
554k 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 ...
user avatar
555 votes
32 answers
1.1m 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 ...
binaryorganic's user avatar
480 votes
5 answers
1.2m 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?
Thierry Lam's user avatar
  • 6,311
157 votes
9 answers
1.3m 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 ...
user avatar
339 votes
5 answers
904k 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 ...
T. Marshall's user avatar
  • 3,493
503 votes
23 answers
357k 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, ...
manifestor's user avatar
  • 6,349
569 votes
6 answers
497k 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/ ...
Robert's user avatar
  • 14.7k
83 votes
16 answers
662k views

What causes SSH error: kex_exchange_identification: Connection closed by remote host?

I setup a SSH server online that is publicly accessible by anyone. Therefore, I get a lot of connections from IPs all over the world. Weirdly, none actually try to authenticate to open a session. I ...
soliz's user avatar
  • 932
256 votes
5 answers
1.3m 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=...
ripper234's user avatar
  • 6,010
640 votes
18 answers
934k 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 ...
cletus's user avatar
  • 10.1k
303 votes
8 answers
1.4m 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?
James Anderson's user avatar
392 votes
27 answers
473k 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 ...
powdahound's user avatar
  • 4,375
190 votes
9 answers
1.2m 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.
DouglasJose's user avatar
  • 2,023
228 votes
11 answers
699k 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! @ @@@@@...
Samuel Edwin Ward's user avatar
0 votes
0 answers
76k views

VM down : Failed to read /vm/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/domains: has this domain already been cleaned up?

I'm having a problem with my xcp-ng server, and I'm using the xcp center 20.04.01 on Linux xcp-ng 4.19.0+1. I didn't done anything like update before the issue occurred, everything was working fine ...
hotips's user avatar
  • 563
392 votes
7 answers
961k 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 ...
Eric Leschinski's user avatar
429 votes
15 answers
784k 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 * ...
Adam Matan's user avatar
  • 13.5k
145 votes
35 answers
559k 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 ...
Gregor Menih's user avatar
  • 1,553
186 votes
6 answers
1.3m views

What port does SFTP use?

Does SFTP use port 21 or port 22?
Daniel's user avatar
  • 3,801
131 votes
14 answers
1.2m 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?
Kyle Brandt's user avatar
  • 84.3k
158 votes
2 answers
984k 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 ?
user9517's user avatar
  • 116k
311 votes
5 answers
715k 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; ...
jeffreyveon's user avatar
  • 3,275
554 votes
11 answers
598k 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 ...
MikeN's user avatar
  • 8,482
82 votes
15 answers
711k 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 ...
JustBeingHelpful's user avatar
256 votes
12 answers
578k 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 ...
Chockomonkey's user avatar
  • 2,703
60 votes
8 answers
663k 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 ...
Leonardo's user avatar
  • 705
310 votes
14 answers
1.0m 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-...
alastairs's user avatar
  • 3,235
302 votes
16 answers
727k 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 ...
psp's user avatar
  • 3,283
208 votes
6 answers
729k 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 ...
Svish's user avatar
  • 7,207
152 votes
5 answers
242k views

What is the difference between authentication and authorization?

Basic question from a novice: What is the difference between authentication and authorization?
user avatar
258 votes
8 answers
1.0m views

How do I add Access-Control-Allow-Origin in NGINX?

How do I set the Access-Control-Allow-Origin header so I can use web-fonts from my subdomain on my main domain? Notes: You'll find examples of this and other headers for most HTTP servers in the ...
Chris McKee's user avatar
  • 3,529
212 votes
13 answers
574k 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 ...
Superbest's user avatar
  • 5,335
287 votes
15 answers
539k 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 ...
user avatar
217 votes
9 answers
1.0m views

How to check sshd log?

I have Ubuntu 9.10 installed with sshd and I can successfully connect to it using login and password. I have configured an RSA key login and now have "Server refused our key" as expected. Ok, now I ...
grigoryvp's user avatar
  • 3,765
127 votes
4 answers
1.0m 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?
Boris Pavlović's user avatar
146 votes
3 answers
189k 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 ...
K_dar's user avatar
  • 1,463
204 votes
6 answers
804k views

How do I convert a .cer certificate to .pem?

I have a .cer certificate and I would like to convert it to the .pem format. If I remember correctly, I used to be able to convert them by exporting the .cer in Base64, then renaming the file to .pem ...
systempuntoout's user avatar
597 votes
4 answers
341k 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 ...
tobym's user avatar
  • 6,421
368 votes
19 answers
599k views

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)?
Richard's user avatar
  • 3,962
169 votes
4 answers
243k views

Getting "Cannot ioctl TUNSETIFF tun: Operation not permitted" when trying to connect to OpenVPN

I'm trying to setup an OpenVPN Access Server in AWS using the market place AMI, but I;m struggling to connect to it. The access server is up and running. I've also added a user with Auto-Login and ...
Stephen Melrose's user avatar
25 votes
9 answers
317k 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 "...
JustBeingHelpful's user avatar
69 votes
11 answers
218k views

How do I check if Log4j is installed on my server?

I have read about security vulnerabilities related to Log4j. How do I check if Log4j is installed on my server? My specific servers use Ubuntu 18.04.6 LTS. I have installed many third-party packages ...
Uri's user avatar
  • 881
228 votes
17 answers
722k 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 ...
Vorleak Chy's user avatar
  • 2,421
343 votes
27 answers
554k 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 ...
gareth_bowles's user avatar