Tag Archives: ssh

sudo: no tty present and no askpass program specified | sudo: no tty present and no askpass program specified

I was setting up automated logon with SSH, and wanted to have root access via sudo to perform certain tasks. Ended up getting these errors when I tried to run sudo commands over the ssh link.

The cause of this error is not having the correct setup on your /etc/sudoers file. Here is the fix.

Edit your sudoers file with


Ensure your usernames entry looks like this.

Ensure the NOPASSWD is present, that does the trick.


Increasing the buffer size or line count on a SSH Putty session. | linux lines buffer ssh putty

Sometimes when ssh’ing to a Linux machine from you Windows box its much easier to cut and copy content from the session into something like notepad in Windows.

If you attempted this on a standard putty session you will only see around 200 lines, I increased mine to 2000.

Screenshot below explains how.

Raspberry Pi – Xbian 1.0 – Kodi 17.0 Default username and password | default username and password for kodi 17.0 xbian 1.0

Been looking this is solution for ages! Finally got it!

Usually the default username and password for Xbian is

username: pi

password: raspberry

But in this scenario its different.



Howto open ports into your Docker containers | docker ubuntu how to open ports in containters

I’m playing around with docker containers, I just wanted to build a docker container and run a service on it which will be accessible externally.

Lets start by getting a fresh ubuntu image from the repos.

Lets see what images are now available, you should see the latest download in the list.

You see this. We’ll pick the newest one.

Now this is how we select the image and open the ports, see the “-p” switches? This will open SSH (22) and Web (80).

This will build the container, once your at the logon prompt you will need to install the services, ie

This will update apt and install apache and ssh

This will start the services.

This will enable the services to start at startup.

Now the container is setup we can exit out.

Once we have exited we’ll start the container.

Now we need to find out if the container is running, and if its running which random ports its assigned to our services.

That command will display the following.

Now the above output tells us the container is running and it has assigned ports to out services. So if you put up the webbrowser on your computer and put the hosts IP in like this,

Now you should see the apache test page.

or is you want to ssh into the container enter this command

Just name sure you setup a user account on the container first.

GeoIP – Converting IPs to Physical Locations. | locate based on IP geoip maxmind tracing

I manage a large scale SSH server. This server is open to the world via SSH port 22.

Considering I only have Australian clients I would expect only Australian IP’s connected to it, so how would I know?

You can google the IP but that is a manual time consuming process. So I have automated it!

There is a open source tool called GeoIP. Its available by default on Debian and Redhat based distros. Install it with the following method.







As you can see above, it resolves IP to country. This was perfect for the work I was doing but if you want specific city and GPS coordinates you need to download a higher detailed database from Maxmind.

So to update the database perform the following.


Now that you have the new database, you need to advise Geoip of the new database file.


As you can see, more detail than before.

Hacking your way out of corporate networks. | bypassing corporate networks with ssh proxy corkscrew

Most corporate networks have implemented some tight security, especially around their outbound connections.

So connecting to your home Linux box over SSH is a “no-no”

Usually corporations have two services they cannot block, HTTP and HTTPS (port 80 and 443) . But they can control them via URL filtering, this does not really affect us for this exercise.

To start off with, on your home router ensure you have a rule forwarding all 443 (https) traffic to your linux box on port 22. This way, if you work is monitoring connections it doesn’t stick out like dogs balls!

Im most cases this may be enough to get you connected, that is if they dont redirect the HTTPS traffic though a proxy server.


If you still cant connect, do this.

On your ubuntu box,

The corkscrew help screen looks like this

you can test corkscrew by doing the following

When you see “SSH-2.0” or something similar you can be sure that you are talking to the other end.

Ok now you’ll need to configure your SSH configuration file, located in ~/.ssh/config , if its not there create it. By default the ssh client looks there first before establishing ssh connections.

Edit the file like this

Paste something like this

So,  here is a description of the listed variables

home = pick any name, once file is save this is the hostname you will ssh to.

hostname = this is the IP address of your home router

port = this is the port we changed on the router, 443 recommended

user = the username on your home system

proxy = this is where you enter your proxies ip and port.

Once all this is finished and saved, just enter the following.

This will ask you for a password and should be in!



Killing stale SSH connections | linux centos bash stale ssh connections script ClientAliveInterval

I administer a large scale SSH server with upwards of 300+ concurrent sessions. This server presents some challenges.  When migrated to AWS it started experiencing a large number of stale SSH sessions.

Fixing this was achieved in two parts. First was a bash script which ran every hour which culled all the stale connections.

The second part was to specify keepalive packets at 5 second intervals in the /etc/ssh/sshd_config file.


Executing SFTP transfers in BASH scripts | linux centos ssh rcp sftp ftp bash script batch file automation

I need to write a script which fetched files off a ftp server and put it into a specify folder for processing.

I was used to using SSH for these job and now I was forced to connect to an SFTP server, this was my first time and everything is a little different.

I have attached the commands I used in my bash script to get the project over the line.


This command allows you get a listing of what is currently on the server.

This will fetch all the CSV files on the SFTP server and copy them locally.

This was partially tricky, don’t know why. They may be an easier way which I overlooked but this worked for me. For some reason to send file you need to specify the instructions in a batch file which is execute once connected.


Displaying a message when connecting via SSH

This is how you can display a message or warning in Linux when connecting via SSH.

You start off by editing the message you want to display,

Then specify the location in the ssh server config