Search This Blog

Wednesday, April 02, 2008

ssh to remote server without password

  1. install openssh in both local and remote machine;
  2. run ssh-keygen in the local machine,you'll get id_rsa and id_rsa.pub;
  3. well,the file id_rsa stors your private key,you must keep it secret;
  4. while id_rsa.pub is the public key,just keep it from writing by others.
  5. deliver id_rsa.pub to the remote server you want to login without password by whatever ways,e.g. scp .ssh/id_rsa.pub user@server:.ssh/ of course you will be prompted for password this time,make sure there is a .ssh directory in the remote server and it's mode is 700
  6. cat .ssh/id_rsa.pub >> .ssh/authorized_keys (run in remote server)
  7. chmod 644 .ssh/id_rsa.pub .ssh/authorized_keys (also in remote server)
  8. now have a try.
note:when you run ssh server without a username,ssh asumes you want to login to remote server with the same user as the local one.
note2:
if you put your non-root user's public key to /root/.ssh of the remote server,then you can login to remote server as root directory,so either avoid this situation or protect the password of your local account.

Friday, February 22, 2008

a note about autoconf and automake

after several hours,I got autoconf and automake to work on my program,known as following(with autoconf-2.61 and automake-1.10):

1.run autoscan in the source directory,and we can get a file named configure.scan

2.
modify the configure.scan so that it makes sense to our project,

  • first of all is AC_INIT macro,i.e. our project name,version,and contact address;
  • then add a macro AM_INIT_AUTOMAKE (be careful of the red M),fill it with the project name and version,if it does not exist,then aclocal will not work properly;
  • and do not touch AC_CONFIG_HEADER ,it's for people who want make their project portable with a "config.h",so do not feed your project's header files to it;at last comes AC_OUTPUT,set it with "Makefile";
  • other macros are project specified,so we skip them here;
  • rename configure.scan to configure.ac or configure.in
3.run aclocal to generate aclocal.m4(if no aclocal.m4 generated,there must be something wrong)

4.run autoconf to generate configure

5.create a file Makefile.am,

  • set macro bin_PROGRAMS=names(it's the executable file's name,like emacs,mplayer,etc)
  • name_SOURCES=files(it's the sources files whitch the binary relies on)
  • name_LDFLAGS=flags(e.g. if we use expat, add -lexpat here)
many other macros can be useful,too,but omitted here.

6.run automake -a,touch files which it complains can not find.

7.all right,run ./configure now, we can get Makefile automatically,wonderful,isn't it?

Thursday, December 06, 2007

slime-close-parens-at-point

the default key binding of the function slime-close-parens-at-point is C-c C-q
but it's obsolete from slime-2.0_p20070816-r1,the comments in the source file are as following:

;; SLIME-CLOSE-PARENS-AT-POINT is obsolete:

;; It doesn't work correctly on the REPL, because there
;; BEGINNING-OF-DEFUN-FUNCTION and END-OF-DEFUN-FUNCTION is bound to
;; SLIME-REPL-MODE-BEGINNING-OF-DEFUN (and
;; SLIME-REPL-MODE-END-OF-DEFUN respectively) which compromises the
;; way how they're expect to work (i.e. END-OF-DEFUN does not signal
;; an UNBOUND-PARENTHESES error.)

;; Use SLIME-CLOSE-ALL-PARENS-IN-SEXP instead.


well,bind slime-close-all-parens-in-sexp to C-c C-q,and I can pretend that nothing happened in my world.