Cun Zhang’s Blog

November 6, 2008

VNC use SSH tunnel on Debian

Filed under: Linux — Tags: , , — Cun Zhang @ 19:07
  1. Install SSH server and VNC server:

    apt-get install ssh vnc4server

  2. SSH server configuration
    See My past post SSH login without password
  3. VNC server configuration
    cunzhang@node31:~$ cat .vnc/xstartup

    #!/bin/sh# Uncomment the following two lines for normal desktop:
    # unset SESSION_MANAGER
    # exec /etc/X11/xinit/xinitrc[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
    xsetroot -solid grey
    vncconfig -iconic &
    x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
    #x-window-manager &
    xfce4-session&

    cunzhang@node31:~$ cat /etc/xinetd.d/xvncserver

    service vnc-1024×768x24
    {
    protocal = tcp
    socket_type = stream
    wait = no
    user = nobody
    servr = /usr/bin/Xvnc
    server_args = -inetd -query localhost -localhost -once -geometry 102×768 -depth 24
    port = 5901
    }

  4. SSH client Installation and configuration
    I use Windows and OpenSSH. Download OpenSSH and install the client.And download the pub key from the remote server.
  5. VNC viewer Installation
    I use TightVNC viewer.Install it with the default cofiguration.
  6. Create a batch file to use SSH  tunnel to connect the server.

    ssh -l cunzhang 192.168.1.1 vnc4server :1 -localhost
    ssh -l cunzhang 192.168.1.1 -L 5901:127.0.0.1:5901
    ssh -l cunzhang 192.168.1.1 vnc4server -kill :1

  7. Run This batch file and open the TightVNC viewer, input 127.0.0.1:1,then input password.

Now You’r working in the remote desktop.
Reference:

  1. http://osric-life.blogspot.com/2007/09/vnc-server-on-debian.html
  2. http://hi.baidu.com/tekjian/blog/item/fe0955ec1a2b28d2b21cb179.html

October 3, 2008

Start Matlab from console under Unix/Linx

Filed under: Linux, Math — Tags: , — Cun Zhang @ 21:48

Under Unix/Linux, you can run matlab without GUI,which always is so usefully for me.

For me, I run Matlab programs for long time in a remote server. If a Matlab  GUI is opened ,I can’t disconnect the remote server. But when I run Matlab without GUI, I can do it with screen command.

Here is a example:

cunzhang@node31:~$ screen -S a

Then enter a visual terminal

cunzhang@node31:~$matlab -nodisplay -r  myprogram

Now you can disconnect your remote server.If you want to see whether your program is done, just run command

cunzhang@node31:~$ screen -r a

For more information, please see:

1. GNU screen’s homepage

2. http://gentoo-wiki.com/TIP_Using_screen

3. http://sunsite.ualberta.ca/Documentation/Gnu/screen-3.9.4/html_chapter/screen_toc.html

4. matlab function reference

June 3, 2008

Debian Nvidia driver installation with kernel 2.6.25(Xen)

Filed under: Linux — Tags: , , , — Cun Zhang @ 17:17

Now I use Debian Sid with kernel 2.6.25 which xen support is built in. For this reason the nvidia driver can’t be installed.

1. download nvidia driver

I use Nvidia Geforce MX 4000, so I should download NVIDIA-Linux-x86-96.43.05-pkg1.run driver

2. patch a diff file for kernel 2.6.25

download NVIDIA_kernel-96.43.05-2290218.diff.txt

Then run

# sh /path/to/NVIDIA-Linux-x86-96.43.05-pkg1.run –apply-patch NVIDIA_kernel-96.43.05-2290218.diff.txt

#export IGNORE_XEN_PRESENCE=1
# sh NVIDIA-Linux-x86-96.43.05-pkg1-custom.run

Now the nvidia graphics driver is installed successfully.

Here are two good article about this subject.

1. http://www.nvnews.net/vbulletin/showthread.php?t=110088

2. http://blog.creonfx.com/linux/how-to-install-nvidia-driver-on-2625-2-debian-kernel-with-xen

May 29, 2008

filezilla as sftp client

Filed under: Linux, Windows — Tags: , — Cun Zhang @ 12:55

Today I review filezilla’s homepage, and find it has supported SSH File Transfer Protocol (SFTP). A few days before, I have search a good sftp client for so many times, but just find winscp and SSH Secure File Transfer Client.

Of course, the last two are good too, but I like filezilla more :)

The following is about FileZilla Features

Overview

FileZilla Client is a fast and reliable cross-platform FTP, FTPS and SFTP client with lots of useful features and an intuitive interface.

Features

Among others, the features of FileZilla include the following:

  • Easy to use
  • Supports FTP, FTP over SSL/TLS (FTPS) and SSH File Transfer Protocol (SFTP)
  • Cross-platform. Runs on Windows, Linux, *BSD, OSX and more
  • Available in many languages
  • Supports resume and transfer of large files >4GB
  • Powerful Site Manager and transfer queue
  • Drag & drop support
  • Configurable Speed limits
  • Filename filters
  • Network configuration wizard
  • Remote file editing
  • Keep-alive
  • FTP-Proxy support

May 28, 2008

linux screen command’s usage

Filed under: Linux — Tags: — Cun Zhang @ 17:14

Screen is a must have for anyone that works on remote boxes via the command line. There are many reasons for this, but a few of them are:
1. screen is an easy way to allow processes to continue running after the session is terminated
2. if you lose connection screen will save your spot

The following is  about how to use screen command:

screen [options] [command [args] ]

Provide ANSI/VT100 terminal emulation, making it possible to run multiple full-screen pseudo-terminals from one real terminal, and letting you manipulate and save your screen input and output, copy and paste between windows, etc.

Options

-a

Include all capabilities in each window’s termcap.

-A

Adapt all windows to the size of the current terminal. Default is to try to use the previous window size.

-c file

Use file as the configuration file instead of the default $HOME/.screenrc.

-d

Detach session running elsewhere. With -r, reattach to this terminal. With -R, reattach to this terminal or create it if it doesn’t already exist. With -RR, use the first session when reattaching if more than one session is available.

-D

Detach session running elsewhere, logging out before detaching. With -r, reattach to this terminal. With -R, reattach to this terminal or create it if it doesn’t already exist. With -RR, do whatever is necessary to create a new session.

-e xy

Change command characters. Specify x as the command character (default Ctrl-a) and y as the character that generates a literal command character (default a). Specify in caret notation (e.g., -e ^Pp to set Ctrl-p as the command character, which is useful for emacs-mode shell ).

-f, -fn, -fa

Turn flow control on, off, or to automatic-switching mode.

-h num

Specify the size of the history scrollback buffer.

-i

Cause the interrupt key (usually Ctrl-c) to interrupt the display immediately when flow control is on. Use of this option is discouraged.

-l, -ln

Turn login mode on or off for /etc/utmp updating.

-ls, -list

Print list of pid.tty.host strings identifying screen sessions.

-L

Tell screen that automargin terminal has a writable last position.

-m

Ignore the $STY environment variable and create a new session. With -d, start session in detached mode; useful for scripts. With -D, start session in detached mode but don’t fork a new process; the command exits if the session terminates.

-O

Use optimal output mode for terminal rather than true VT100 emulation.

-p window

Preselect the specified window if it exists.

-q

Suppress error message printing on startup. Exit with nonzero return code if unsuccessful.

-r [pid.tty.host]

-r sessionowner/[pid.tty.host]

Resume detached session. No other options except -d or -D can be specified. With sessionowner, resume another user’s detached session; requires setuid root.

-R

Attempt to resume the first session found, or start a new session with the specified options. Set by default if screen is run as a login shell.

-s shell

Set the default shell, overriding the $SHELL environment variable.

-S name

Specify a name for the session being started.

-t name

Set the window’s title.

-T term

Set $TERM to term instead of “screen”.

-U

Run in UTF-8 mode and set the default for new windows to UTF-8.ctrl.

-v

Print version information and exit.

-wipe [match]

Like -ls, but remove destroyed sessions instead of marking them dead. If a match is specified, it should be in the same form as the argument to the -r option.

-x

Attach to a session that is not detached. Requires multi-display mode.

-X

Run specified command in specified session. Requires multi-display mode, and session must not be password-protected.

Key bindings

screen commands consist of a command character (Ctrl-a by default) followed by another character. For many of the commands, you can also specify the character as Ctrl-character–e.g., Ctrl-a Ctrl-d as well as Ctrl-a d. The default key bindings are listed here. You can change the bindings for yourself in the $HOME/.screenrc configuration file, or for all users in /etc/screenrc. The term in parentheses that follows the description is the equivalent configuration-file command for changing the key binding.

Ctrl-a ‘

Prompt for window name or number to switch to. (select)

Ctrl-a “

List all windows for selection. (windowlist -b)

Ctrl-a num

Switch to window num, where num is a digit in the range 0-9 or - (the blank window). (select num)

Ctrl-a Tab

Switch input focus to next region. (focus)

Ctrl-a Ctrl-a

Toggle to previously displayed window. (other)

Ctrl-a a

Send the command character (Ctrl-a) to the window. (meta)

Ctrl-a A

Prompt user to enter a name for the current window. (title)

Ctrl-a b

Send a break to the window. (break)

Ctrl-a B

Reopen the terminal line and send a break. (pow-break)

Ctrl-a c

Create a new window with a shell and switch to it. (screen)

Ctrl-a C

Clear the screen. (clear)

Ctrl-a d

Detach screen from this terminal. (detach)

Ctrl-a D D

Detach and log out. (pow-detach)

Ctrl-a f

Toggle flow control between on, off, and auto. (flow)

Ctrl-a F

Resize window to current region size. (fit)

Ctrl-a Ctrl-g

Toggle visual bell mode. (vbell)

Ctrl-a h

Write contents of the current window to the file hardcopy.n. (hardcopy)

Ctrl-a H

Begin/end logging of the current window to the file screenlog.n. (log)

Ctrl-a i

Show information about this window. (info)

Ctrl-a k

Kill current window. (kill)

Ctrl-a l

Refresh current window. (redisplay)

Ctrl-a L

Toggle window’s login slot. Requires that screen be configured to update the utmp database. (login)

Ctrl-a m

Redisplay last message. (lastmsg)

Ctrl-a M

Toggle monitoring of the current window. (monitor)

Ctrl-a Space

Ctrl-a n

Switch to next window. (next)

Ctrl-a N

Show number and title of current window. (number)

Ctrl-a Backspace

Ctrl-a h

Ctrl-a p

Switch to previous window. (prev)

Ctrl-a q

Send a start signal (associated with Ctrl-q by terminals) to current window. (xon)

Ctrl-a Q

Delete all regions except the current one. (only)

Ctrl-a r

Toggle current window’s line-wrap setting. (wrap)

Ctrl-a s

Send a stop signal (associated with Ctrl-s by terminals) to current window. (xoff)

Ctrl-a S

Split current region into two new regions. (split)

Ctrl-a t

Show system information, including time and date. (time)

Ctrl-a v

Display version information. (version)

Ctrl-a Ctrl-v

Enter digraph for entering characters that can’t normally be entered. (digraph)

Ctrl-a w

List all windows. (windows)

Ctrl-a W

Toggle 80/132 columns. (width)

Ctrl-a x

Lock terminal. (lockscreen)

Ctrl-a X

Kill the current region. (remove)

Ctrl-a z

Suspend screen. (suspend)

Ctrl-a Z

Reset virtual terminal to its “power-on” values. (reset)

Ctrl-a .

Write out a .termcap file. (dumptermcap)

Ctrl-a ?

Show all key bindings. (help)

Ctrl-a Ctrl-\

Kill all windows and terminate screen. (quit)

Ctrl-a :

Enter command-line mode. (colon)

Ctrl-a [

Ctrl-a Esc

Enter copy/scrollback mode. (copy)

Ctrl-a ]

Write contents of the paste buffer to the standard input queue of the current window. (paste)

Ctrl-a {

Ctrl-a }

Copy and paste a previous line. (history)

Ctrl-a >

Write paste buffer to a file. (writebuf)

Ctrl-a <

Read screen-exchange file into paste buffer. (readbuf)

Ctrl-a =

Remove file used by Ctrl-a < and Ctrl-a >. (removebuf)

Ctrl-a ,

Show where screen comes from, where it went to, and why you can use it. (license)

Ctrl-a _

Start/stop monitoring the current window for inactivity. (silence)

Ctrl-a *

List all currently attached displays. (displays)

Older Posts »

Powered by WordPress