2017年9月26日 星期二

Install sshpass

Last updated on Sep 26th, 2017 by sammtcbn

[1] Install sshpass on babun

At first, download latest sshpass from sourceforge.
Next, launch babun shell and enter following commands to install it.

# tar zxfv sshpass-1.05.tar.gz
# cd sshpass-1.05
# ./configure
# make
# make install

Then, sshpass.exe will be installed in /usr/local/bin .
Now I can use sshpass+ssh to login my server from my babun shell.

# sshpass -p password ssh user@ip

Example: Login and run command free to check memory usage.
# sshpass -p password ssh -o StrictHostKeyChecking=no user@ip free

Example: Use sshpass+scp to upload file.
# sshpass -p password scp -o StrictHostKeyChecking=no file user@ip:Path

[2] Install sshpass on Ubuntu 16.04.2

$ sudo apt-get update

$ sudo apt-get install sshpass

2017年9月5日 星期二

automake 筆記


$ ls hello.c
hello.c


$ cat hello.c
#include stdio.h

int main (void)
{
    printf ("hello\n");
    return 0;
}


$ autoscan


$ ls
autoscan.log  configure.scan  hello.c


$ cp configure.scan configure.ac


$ vi configure.ac
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE(hello, 1.0)
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_OUTPUT(Makefile)


$ ls
autoscan.log  configure.ac  configure.scan  hello.c


$ aclocal


$ ls
aclocal.m4  autom4te.cache  autoscan.log  configure.ac  configure.scan  hello.c


$ autoheader


$ ls
aclocal.m4  autom4te.cache  autoscan.log  config.h.in  configure.ac  configure.scan  hello.c


$ autoconf


$ ls
aclocal.m4      autoscan.log  configure     configure.scan
autom4te.cache  config.h.in   configure.ac  hello.c


$ vi Makefile.am
bin_PROGRAMS=hello
hello_SOURCES=hello.c


$ touch NEWS README AUTHORS ChangeLog


$ automake --add-missing


$ ls
aclocal.m4      autoscan.log  config.h.in   configure.scan  hello.c     Makefile.am  NEWS
AUTHORS         ChangeLog     configure     COPYING         INSTALL     Makefile.in  README
autom4te.cache  compile       configure.ac  depcomp         install-sh  missing


$ ./configure


$ ls
aclocal.m4      compile        configure       hello.c      Makefile.in
AUTHORS         config.h       configure.ac    INSTALL      missing
autom4te.cache  config.h.in    configure.scan  install-sh   NEWS
autoscan.log    config.log     COPYING         Makefile     README
ChangeLog       config.status  depcomp         Makefile.am  stamp-h1


$ make
make  all-am
make[1]: Entering directory '/home/samlin/hello'
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT hello.o -MD -MP -MF .deps/hello.Tpo -c -o hello.o hello.c
mv -f .deps/hello.Tpo .deps/hello.Po
gcc  -g -O2   -o hello hello.o
make[1]: Leaving directory '/home/samlin/hello'


$ ls
aclocal.m4      ChangeLog    config.log     configure.scan  hello.c     Makefile     NEWS
AUTHORS         compile      config.status  COPYING         hello.o     Makefile.am  README
autom4te.cache  config.h     configure      depcomp         INSTALL     Makefile.in  stamp-h1
autoscan.log    config.h.in  configure.ac   hello           install-sh  missing


$ ./hello
hello