Programming & Tools/Linux2017. 10. 16. 15:17

Ubuntu 에서 시리얼로 Login 하기 위한 방법이다.

 

[STEP1]

dmesg로 현재  어떤 tty로 잡혔는지 확인한다.

 

 $ dmesg | grep tty
[    0.000000] console [tty0] enabled
[    5.450723] 00:02: ttyS4 at I/O 0x240 (irq = 7, base_baud = 115200) is a 16550A
[    5.471716] 00:03: ttyS5 at I/O 0x248 (irq = 5, base_baud = 115200) is a 16550A


 

[STEP2]

해당 서비스를 생성 한다.

 $ /lib/systemd/system# gedit ttyS4.service

[Unit]
Description=Serial Console Service

 

[Service]
ExecStart=/sbin/getty -L 115200 ttyS4 vt102
Restart=always

 

[Install]
WantedBy=multi-user.target



[STEP3]

system control를 재로드 한다.

 $/lib/systemd/system# systemctl daemon-reload

 

[STEP4]

해당 tty를 활성화 시킨다.

 $/lib/systemd/system# systemctl enable ttyS4

 

[STEP5]

해당 tty를 시작 한다.

 $/lib/systemd/system# systemctl start ttyS4

 

Posted by 다크쌍피
Programming & Tools/Linux2017. 7. 3. 23:57

리눅스에서 파일 확장자를 변경 할때 보통 "mv" 명령어로 바꾸는데, 한꺼번에 많은 파일을

변경 하려고 할때는  rename을 사용하면 된다.

 

예를 들어 .c 파일을 .cpp 로 변경 하려면 다음과 같이 명령어를 입력 하면된다.

 $rename 's/\.c/\.cpp/' *

 

Posted by 다크쌍피
Programming & Tools/Linux2017. 5. 2. 14:44

encode_video.c

 

    /* find the mpeg1video encoder */
    codec = avcodec_find_encoder_by_name(codec_name);
    if (!codec) {
        fprintf(stderr, "Codec not found\n");
        exit(1);
    }

 

FFMPEG에서 avcodec_find_encoder_by_name("libx264) 호출 시 Codec을 못 찾을 경우

pkgconfig일 저장 위치인 PKG_CONFIG_PATH 가 환경 변수에 지정 되어 있는지 확인한다.

 

ex.> .bashrc 내에 ffmpeg이 빌드된 위치 추가

export PKG_CONFIG_PATH=/home/dark2pee/ffmpeg/build/lib/pkgconfig

Posted by 다크쌍피
Programming & Tools/Linux2017. 1. 11. 11:35

$ ifconfig

enp0s31f6   Link encap:Ethernet  HWaddr 00:30:64:18:4b:6b
          inet addr:192.168.1.63  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::18c2:c3dd:6a67:99dc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1184 errors:0 dropped:0 overruns:0 frame:0
          TX packets:139 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:129322 (129.3 KB)  TX bytes:21962 (21.9 KB)
          Interrupt:16 Memory:df100000-df120000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:235 errors:0 dropped:0 overruns:0 frame:0
          TX packets:235 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:18673 (18.6 KB)  TX bytes:18673 (18.6 KB) 

 

 

"/etc/default/grub" 를 에디터로 아래 내용을 변경한다.

 

#GRUB_CMDLINE_LINUX=""

 

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

 

 

그리고 반드시 업데이를 해줘야 함.

$ sudo update-grub

 

시스템을 재시작 한다.

$ sudo reboot

 

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:30:64:18:4b:6b
          inet addr:192.168.1.63  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a222:5ba2:694:80da/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:70 errors:0 dropped:0 overruns:0 frame:0
          TX packets:126 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:11995 (11.9 KB)  TX bytes:18626 (18.6 KB)
          Interrupt:16 Memory:df100000-df120000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:198 errors:0 dropped:0 overruns:0 frame:0
          TX packets:198 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:15387 (15.3 KB)  TX bytes:15387 (15.3 KB)

 

이제 eth0를 내가 원하는 이름으로 다시 변경 하도록 하자.

 

아래 경로에 "70-persistent-net.rules" 파일을 생성한다.

 $ sudo vi /etc/udev/rules.d/70-persistent-net.rules

 

아래 내용을 추가하고 저장 한다.

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device lan Device
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="aa:aa:aa:aa:aa:aa", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="ethX"

 

# PCI device Wlan Device
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="aa:aa:aa:aa:aa:aa", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="wlanX"

 

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="NB_wlan"

 

$ ifconfig

NB_wlan   Link encap:Ethernet  HWaddr 00:30:64:18:4b:6b
          inet addr:192.168.1.63  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::18c2:c3dd:6a67:99dc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1184 errors:0 dropped:0 overruns:0 frame:0
          TX packets:139 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:129322 (129.3 KB)  TX bytes:21962 (21.9 KB)
          Interrupt:16 Memory:df100000-df120000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:235 errors:0 dropped:0 overruns:0 frame:0
          TX packets:235 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:18673 (18.6 KB)  TX bytes:18673 (18.6 KB)

 

 

Posted by 다크쌍피
Programming & Tools/Linux2013. 9. 5. 16:58

U-buntu 10.04에서 tftpd를 실행하고, Client에서 put을 하면 Access violation이 발생 한다.

이는 10.x 부터 보안상의 이유로 tftpd에서는 get만을 지원하도록 하였다.

이를 해결하기 위해서는 tftp대신에 HPA's tftp 를 설치하면 된다.

U-Buntu Software Center에서 Trivial file transfer protocol client 와  Trivial file transfer protocol client

Remove 시키고 HPA's tftp serverHPA's tftp clientInstall 한다.

또는 쉘에서

$ sudo apt-get install tftp-hpa

$ sudo apt-get install tftpd-hpa

로 설치 한다.


기본 설치를 하였을 경우 똑 같이 get 만을 지원하므로 put을 지원하기 위해서는 Option을 수정 해주어야 한다.

tftpd 에서는 "/etc/xinetd.d/tftp" 에 설정 정보가 있었지만, tftpd-hpa는 "/etc/default/tftpd-hpa"에

설정 정보가 존재 한다.


put을 지원하려면

/etc/default/tftpd-hpa의 항목을 다음과 같이 수정해주어야 한다.


 

TFTP_OPTIONS="--secure --create"


또한 tftpd 디렉토리 및 사용자 이름등도 원하는대로 수정하면 된다.

 


* /etc/default/tftpd-hpa 의 항목 중 TFTP_DIRECTORY 에서 정의된 디렉토리가 기존에 존재한다면, 프로그램이 비정상동작

하는 경우가 발생을 한다. 그러므로 처음 설치 하기 전에 /tftpboot 디렉토리 혹은 /var/lib/tftpboot 디렉토리이름을 변경하고 설치 하도록 한다.

Posted by 다크쌍피
Programming & Tools/Linux2012. 5. 30. 12:48

Linux Kernel 을 디버깅 하다보면 printk의 레벨이 지정되어 있는 것을 볼 수 있는데,

이를 콘솔로 출력하기 위한 설정 명령은 다음과 같다.


echo 8 > /proc/sys/kernel/printk

 

echo 다음이 해당 등급이며 그 등급에 따른 내용은 아래와 같다.


There are eight possible loglevel strings, defined in the header <linux/kernel.h>; we list them in order of decreasing severity:

KERN_EMERG

Used for emergency messages, usually those that precede a crash.

KERN_ALERT

A situation requiring immediate action.

KERN_CRIT

Critical conditions, often related to serious hardware or software failures.

KERN_ERR

Used to report error conditions; device drivers often use KERN_ERR to report hardware difficulties.

KERN_WARNING

Warnings about problematic situations that do not, in themselves, create serious problems with the system.

KERN_NOTICE

Situations that are normal, but still worthy of note. A number of security-related conditions are reported at this level.

KERN_INFO

Informational messages. Many drivers print information about the hardware they find at startup time at this level.

KERN_DEBUG

Used for debugging messages.

Each string (in the macro expansion) represents an integer in angle brackets. Integers range from 0 to 7, with smaller values representing higher priorities.


참조 : http://www.makelinux.net/ldd3/chp-4-sect-2


Posted by 다크쌍피
Programming & Tools/Linux2012. 5. 16. 02:26

Ubuntu 10.4에서 한글 입력 설정 방법

1. Menu Application -> Ubuntu Software Center -> ibus search

2. 목록에서 Hangul engine for IBus 선택 후 Install

3. Meny System -> Preferences -> IBus Preferences -> Input Method tab -> Select an input method -> korea -> Hangul

4. Ununtu restart

Posted by 다크쌍피
Programming & Tools/Linux2012. 5. 2. 00:58

Linux를 설치 후 ssh을 통해서 접속 시 .bashrc가 실행이 안되는 문제가 발생하면

.bash_profile을 아래와 같이 수정해 주면 된다.

 

/home/계정 $  vi .bash_profile

 

# 마지막 줄에 추가

 

if [ -f ~/.bashrc ]; then 
 
. ~/.
bashrc 
fi 
 

 

Posted by 다크쌍피
Programming & Tools/Linux2011. 10. 4. 16:45

1. 파일 다운로드 및 설치
CentOS 6는 아직까지 NXServer가 프로그램 설치로 제공되지 않아서 수동으로 설치 해야 한다.(10/10/03 현재)

http://www.nomachine.com/download-package.php?Prod_Id=3525
Download NX Enterprise Server for Linux Evaluation - i386

RPM version
Download the RPMs
Change your working directory to the location where you saved the package and install it by running from a console:

  # sudo rpm -i nxclient-3.5.0-7.i386.rpm
  # sudo rpm -i nxnode-3.5.0-6.i386.rpm
  # sudo rpm -i nxserver-3.5.0-8.i386.rpm
 
If you don't have the sudo utility installed, log on as superuser ("root") and run the commands without sudo.

2. 사용자 등록
http://www.nomachine.com/documentation/admin-guide.php
/usr/NX/bin/nxserver --keygen
/usr/NX/bin/nxserver --useradd 사용자이름
vi /usr/NX/etc/server.cfg
     #EnableUserDB = "0"  --> EnableUserDB = "1"
     #EnablePasswordDB = "0" --> EnablePasswordDB = "1"
~/.ssh/chown nx:root authorized_keys2
~/.ssh/chmod 0644 authorized_keys2

/usr/NX/share/keys/default.id_dsa.key  <<- NXClient의 key값
/usr/NX/bin/nxserver --restart

Posted by 다크쌍피
Programming & Tools/Linux2009. 8. 5. 14:53

1. 개요
  Windows에서 원격데트크톱 연결을 사용하면, 외부에서 나의 컴퓨터를 Remote로 연결하여 사용 할 수 있어 정말 편하다. 지금까지 우리는 Linux에서는 Terminal로 작업해야 하고, CLI형태로 되어 있어 Linux를 잘모르는 사람은 사용하기 힘들다는 고정 관념을 가지고 있는 사람이 많았다. 이것을 해결 해 주는 프로그램으로 VNC가 나와서 잘 사용하였는데, VNC의 문제점은 컴퓨터가 로그인 되어 있지 않으면, 사용하기 어려운 문제점이 발생 하였는데, 이를 해결해주는게 FreeNX이다.
FreeNX는 SSH를 사용해서 제어 하기 때문에, Linux 시스템이 로그인 되어 있지 않더라도 접근할수 있다.

2. 서버 설치.
$> yum install nx freenx

3. Key-based authentication
$> cd /etc/nxserver
$> cp node.conf.sample node.conf
$> vi node.conf
   ENABLE_PASSDB_AUTHENTICATION="0"  >> ENABLE_PASSDB_AUTHENTICATION="1"
   :wq
$> nxserver --adduser 사용자이름  // 사용자이름에 Login에 사용할 ID를 입력한다.
$> nxserver --passwd 사용자이름 // 위에서 생성한 사용자이름을 입력한 후 Password를 입력한다.
$> nxserver --stop
$> nxserver --start
$> service sshd restart 
$> cat client.id_dsa.key // Client에서 사용할 Key값으로 내용을 복사한 후 Client Key 항목에 복사한다.

4. Windows Client 설치.
http://www.nomachine.com/download-client-windows.php 에서 Client 프로그램을 다운로드 한다.
프로그램을 설치한 후 실행한다.
Configure 창을 띄운 후 Key버튼을 클릭 한다.

내용에 /etc/nxserver/client.id_dsa.key 항목의 내용을 입력 한다.

저장 후 Linux 서버로 접속 한다.
Posted by 다크쌍피