Showing posts with label SSH. Show all posts
Showing posts with label SSH. Show all posts

2012-05-16

Scratch of the day - ssh transfer from server to server

There's 2 servers which configured only my workstation is able to login using ssh keys. But I need to transfer files between these 2 servers. Downloading from server A to my workstation then upload the files to server B seems to be way. It would be good if I can combine the 2 operations into 1 single execution.

With shell's pipe, cat & ssh, this is what I've come up with :
ssh bob@server-A.example.com "cat /source/file-or-directory.txt" | \
ssh bob@server-B.example.com "cat > /destination/file-or-directory.txt"

Shalom !!!

2011-02-04

ssh - How to pipe output from local to remote server

In Bash, with pipe (the "|" symbol) and ssh makes a good combination of server administration tool, securely. Some examples :

2010-06-17

FreeBSD - How to setup & configure jail with ezjail


OS virtualization is a technology that enable multiple copies of guest OS to run on top of a host OS. Why do we wanna do this?
- partition resources to share across multiple guest OS (current hardware to run multiple light guest OS. e.g. FreeBSD & Linux)
- enhance security (guest OS are isolated and thus hacking into a guest OS leaves other OS safe)
- saves power & money (hosting rack space & power are minimize)
- creating environments (application or OS testing, backup, legacy apps, admin delegation)
- improves server management (guest OS within virtualization are easier to move, copy, backup & remove)

FreeBSD Jail first appear in FreeBSD 4.x, introduced by Poul-Henning Kamp. Jail is a powerful OS virtualization that achieves security, cost, management & flexibility. Because of all these advantages, jail can some time be quite complex to setup & configure. Ezjail offers the simplicity to configure & maintain jails, without the complexity of getting our hands dirty. :p

Ezjail is a framework that controls jail. Ezjail takes care of the complicated part and makes setting up & maintenance of jail fun. Ezjail is develop by Dirk Engling, thanks Dirk. :)

FreeBSD jail does have its limitation. Here are the ones I've bump :
- resource control, e.g. ram & processor cannot be partition, they are all equally being shared. But hard disk space can be separate and control by implementing hard disk partition (or slice).
- all guest OS have to use the same kernel version as the host OS

Okay, enough of talking. Here's a simple step-by-step guide on how to setup Ezjail. Firstly, install Ezjail from sysutils/ezjail using Portmanager then proceed the below steps:

2010-06-11

N900 - How to ssh into N900 using OpenSSH

Since the Nokia N900 runs on Maemo, Debian based Linux, it also offers open source programs. The secure shell is one of open source gems. Maemo offers the OpenSSH variety of secure shell.

OpenSSH on Maemo not only offers encrypted secure remote shell, it also comes with functions that runs like the desktop version. Such as ssh socks 5 tunneling, that can be used to encrypt traffic transmit of the programs that supports socks 5 proxy.

Here's how to do it :

2009-10-15

Perl - Connect using SSH with Perl & CPAN module

It has been weeks since the last time blogging about Perl. My day to day job has been tying most of my free time and blah blah blah excuses ... :p

My job deals with FreeBSD server, 90% of my time. Daily routines includes checking server health status. FreeBSD has these periodic scripts that will report server health status to sysadm daily, but the emails are always being "ignore" as the info in it are too vast. So, i decided to cough out a simple Perl script that will use SSH to connect to the servers and pull some health status report. This post will talk about using cpan module's, NET::SSH::Perl, to execute commands then print out the results.

Purpose of this script :
  • connect to server using ssh
  • authenticate only using public key
  • run a command and print out the result

Perl modules used :
  1. Perl::Critic = perl's best practice
  2. Net::SSH::Perl = the basic of using ssh in perl
  3. Net::SSH::Perl::Key::RSA = authenticate using public key
  4. Class::ErrorHandler = needed by Net::SSH::Perl::Key::RSA module

To reduce the hiccups, install the modules listed above by using CPAN client.

Here is the script :

2009-08-18

ssh - How to encrypt/tunnel internet traffic through ssh

When using an insecure internet connection (e.g. wireless), it is a good practice to tunnel internet traffic through ssh. Tunneling through ssh provide encryption of the traffic starting from local computer to the point ends where ssh server is. It is especially important to encrypt the traffic out of the local PC when using un-secure connection as other malicious intent users might be able to sniff packet off the current connection.

How does ssh tunneling works?

2009-07-19

Freebsd - How to install FreeBSD as your Desktop

UPDATE : After testing PC-BSD for a while (more then 6 months), PC-BSD indeed is a FreeBSD variant that is superior in Desktop environment. Its user friendly installation and configuration have make FreeBSD so much more suitable running as an Desktop. Unless you're interested in figuring out how to tweak and turn FreeBSD to work in a Desktop, give PC-BSD a try, you'll love it!
Check it out at PC-BSD website !!!


PsyberMonkey is turning his desktop to FreeBSD and this is the work he has done :-

1. FreeBSD quick install guide (aka How to install FreeBSD).

2. make sure hardware are detected properly
  • How to install or add sound card driver module
  • wireless (how to still in progress)
  • ACPI (still having trouble making it work)
  • remote control through SSH (how to still in progress)
  • all others e.g. external drive formatted in FAT32, display card, track pad, external mouse, gigabit network card & etc are detected and function properly.

3. Using ports to install software - go to Section III.

4. Getting KDE, GNOME and XFCE up and running (how to still in progress)
Other miscellaneous stuff :

This post will be updated periodically to reflect the progress of using FreeBSD as a Desktop.

Adios !!!

2009-06-21

Nokia E71 and E63 tips - shell or command line access using ssh (secure shell)

The Nokia E71 & E63 is a versatile phone for people that needs the business suite of application, e.g. email, messenger, documents & spreadsheet, camera and most importantly, the symbian platform. The symbian platform is widely used on mobile phones. Symbian's platform also have a wide variety of applications.

For *NIX system administration, shell access to the command line (using ssh) of the  servers are part of our life. Having to own Nokia E71 or E63 is one of the best thing as Putty is available on symbian platform. Putty is a symbian application that can connect to server using shell access or command line by ssh, which take advantage of the built-in QWERTY keyboard on Nokia E71 & E63. Putty also allow to use public key authentication, if the private key is installed on the phone or the memory card (mmc). It also allow to configure ssh (secure shell) client to connect to other ports then the default port 22.

2009-05-19

ssh - error "Host key verification failed" when trying to connect or copy a file to ssh server

The below error was display while trying to ssh or scp to a ssh server :










@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for domain-name.com has changed,
and the key for the according IP address xxx.xxx.xxx.xxx
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
00:00:00:00:00:00:00:00:00:00:00:00:.
Please contact your system administrator.
Add correct host key in ~/.ssh/known_hosts to get rid of this message.
Offending key in ~/.ssh/known_hosts:xx
RSA host key for domain-name.com has changed and you have requested
strict checking.
Host key verification failed.
lost connection

2009-02-19

ssh persistent error "Permission denied (publickey)."

One fine day while checking up on cron backup job on the server, it recorded an error while doing a rsync to the backup storage server. All other users have no problem login onto the backup storage server, just this particular username have problem. After checking out the interactive verbose output of the attempt ssh server session, public & private key, log files, server user's credentianls, below is the solution :


Problem :
ssh to server that uses only public key authentication only persistently got,
Permission denied (publickey).
Checked log file and got,
sshd: Authentication refused: bad ownership or modes for directory 
/user/home/directory


Solution :

2009-02-16

Reverse SSH

Problem :
SSH server / PC in a close network unable to open port 22 or ssh port for public access


Solution :