Engineer's tipLinux

vncserver 설정

1. vncserver 명령 실행

vnc 접속시 사용할 패스워드를 입력한다.

[root@sales-linux Desktop]# vncserver

You will require a password to access your desktops.

Password:
Verify:
xauth:  creating new authority file /root/.Xauthority

New ‘sales-linux:1 (root)’ desktop is sales-linux:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/sales-linux:1.log
2. /root/.vnc 디렉토리로 이동 pid 및 log 파일 확인

[root@sales-linux ~]# cd .vnc/
[root@sales-linux .vnc]# ls
passwd  sales-linux:1.log  sales-linux:1.pid  xstartup
3. /root/.vnc/xstartup 파일에서 4,5 라인주석 제거

[root@sales-linux .vnc]# vi /root/.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 &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
twm &
[root@sales-linux .vnc]#
4. vnc 프로세스 확인 및 kill

[root@sales-linux .vnc]# ps ax | grep vnc
11880 pts/0    S      0:00 Xvnc :1 -desktop sales-linux:1 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024×768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -pn
11889 pts/0    S      0:00 vncconfig -iconic
11927 pts/0    S+     0:00 grep vnc
[root@sales-linux .vnc]# kill -9 11880
5. log 파일 및 pid 파일 삭제

[root@sales-linux .vnc]# ls
passwd  sales-linux:1.log  sales-linux:1.pid  xstartup
[root@sales-linux .vnc]# rm sales-linux\:1.*
rm: remove regular file `sales-linux:1.log’? y
rm: remove regular file `sales-linux:1.pid’? y
6. /tmp 디렉토리에서 lock 파일(/tmp/.X1-lock, /tmp/.X11-unix/X1) 삭제

[root@sales-linux .vnc]# cd /tmp/
[root@sales-linux tmp]# ls -al
total 56
drwxrwxrwt  7 root root 4096 Oct 13 09:53 .
drwxr-xr-x 25 root root 4096 Oct 12 18:08 ..
drwxrwxrwt  2 root root 4096 Oct 12 18:08 .font-unix
drwx——  2 root root 4096 Oct 12 18:11 gconfd-root
srw-rw-rw-  1 root root    0 Oct 12 18:08 .gdm_socket
drwxrwxrwt  2 root root 4096 Oct 12 18:11 .ICE-unix
srwxr-xr-x  1 root root    0 Oct 12 18:09 mapping-root
drwx——  2 root root 4096 Oct 12 18:11 orbit-root
-rw——-  1 root root 1024 Oct 12 08:41 .rnd
-r–r–r–  1 root root   11 Oct 12 18:11 .X0-lock
drwxrwxrwt  2 root root 4096 Oct 13 09:53 .X11-unix
-r–r–r–  1 root root   11 Oct 13 09:53 .X1-lock
[root@sales-linux tmp]# rm .X1-lock
rm: remove regular file `.X1-lock’? y
[root@sales-linux tmp]# cd .X11-unix/
[root@sales-linux .X11-unix]# ls -al
total 12
drwxrwxrwt  2 root root 4096 Oct 13 09:58 .
drwxrwxrwt 10 root root 4096 Oct 13 09:58 ..
srwxrwxrwx  1 root root    0 Oct 13 09:53 X1
[root@sales-linux .X11-unix]# rm -rf *
7. vncserver 명령 재실행

[root@sales-linux .vnc]# vncserver

New ‘sales-linux:1 (root)’ desktop is sales-linux:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/sales-linux:1.log

[root@sales-linux .vnc]#
8. vncviewer를 통해서 접속

접속시 “ip:세션번호” 를 입력해서 접속 ex) 192.168.51.17:1

vncserver 명령을 한번 더 실행하면 2번세션이 생성되며, 192.168.51.17:2 로 추가 접속할 수 있다.

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다