반응형

처음 FreeNas를 이용했을 때 CentOS와 비슷하다고 생각해 설정을 변경할때 그냥 /etc/폴더에서 변경하였다.

그런데 이게 어찌된 일인지 바뀐 설정이 다시 원래대로 복구 되는 경우가 생겨 계속 다시 변경해줘야하는 경우가 있었다.

이게 왜 그런지 알아보니 FreeNas는 /conf/base/etc/라는 폴더에 있는 설정을 바꿔줘야 한다고 한다.

추측컨데 재부팅 될 때랑 어느 시점마다 /conf/base/etc/를 /etc/에 붙여넣는것 같다.


기본 설정 변경

/conf/base/etc /


일시적으로 설정 변경

/etc/

반응형
반응형

CentOS 버전확인 방법!


cat /etc/*-release


실행 예시



다른 Linux 버전 확인

http://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_%EC%A2%85%EB%A5%98_%ED%99%95%EC%9D%B8,_%EB%A6%AC%EB%88%85%EC%8A%A4_%EB%B2%84%EC%A0%84_%ED%99%95%EC%9D%B8

위 사이트 참고.

반응형

'Linux > CentOs' 카테고리의 다른 글

CentOs ssh접속 user 계정 추가/삭제.  (2) 2015.12.03
반응형

Linux 계열 OS를 사용하거나 서버를 이용하시는 사람들 중 rsync를 이용해 다른 서버에 backup을 하거나 파일을 전송하는 경우가 있다.

이럴떄 마다 원격 서버의 비밀번호를 입력해야되서 귀찮은 경우가 생기는데 비밀번호 없이 바로 rsync를 이용하는 방법이 있다.

1.

로컬 서버에 ssh key 쌍 생성

ssh-keygen -t rsa

위 명령어를 입력하면 3가지 질문이 뜨는데 그냥 엔터 3번으로 넘어가면 된다.

제대로 실행 됬다면 ~/.ssh 경로에 id_rsa 와 id_rsa.pub 파일이 생성된다.

2.

생성된 key를 원격서버에 전송한다.

ssh-copy-id -i ~/.ssh/id_rsa.pub [원격서버 주소]


3.

이제 rsync를 사용하면 비밀번호를 묻지 않고 바로 실행된다



반응형
반응형

리룩스 및 맥에서 사용할 수 있는 명령어 중 iconv라는 기특한 명령어가 있다.

이 명령어는 문서의 인코딩을 바꿔주는 명령어이다.


iconv의 사용법 :

iconv -f [문서 포맷] -t [변경할 포맷] [파일명] > [결과 파일명] 


만약 CP949로 인코딩 된 문서를 UTF-8로 바꾸고 싶으면

iconv -f CP949 -t UTF-8 text.txt > result.txt

명령어를 수행하면 인코딩이 CP949인 text.txt문서가 UTF-8 인코딩으로 변환된 result.txt로 저장된다.


iconv -l 옵션으로 사용할 수 있는 인코딩 리스트가 출력된다.

반응형

'Linux > 명령어' 카테고리의 다른 글

split 명령어  (0) 2015.12.23
SCP 명령어  (0) 2015.12.07
반응형

split 명령어


파일을 분할할 때 쓰는 Linux용 명령어이다.


사용법 : 

split [-options] [파일명] [분할된 파일 머릿글]


옵션 :

-l [라인수] : 지정된 라인수 만큼 파일을 나눈다.

-b [크기] : 지정된 크기의 byte만큼 파일을 나눈다.


예제 : 

split -l 50 temp.txt

50라인씩 xaa, xab, xac...으로 분할된 파일이 생성된다.


split -l 50 temp.txt temp

tempaa, tempab, tempac...로 분할된 파일이 생성된다.


split -b 1024 temp.txt

1024byte 크기로 분할된 파일이 생성된다.


분할된 파일을 합칠때는 cat x* > temp.txt를 이용하면 xaa,xab,xac..로 분할된 파일들이 합쳐진다.

반응형

'Linux > 명령어' 카테고리의 다른 글

iconv 명령어  (0) 2015.12.29
SCP 명령어  (0) 2015.12.07
반응형

scp는 리룩스에서 사용되는 서버로서버로 파일 복사및 전달하는 명령어이다.

사용법:

1. 원격 서버 -> 로컬 서버

scp -options 계정@원격서버주소:파일경로 전송받을위치

2.로컬 서버 -> 원격서버

scp -options 전송파일위치 계정@원격서버주소:전송받을위치


options:

-P : 포트번호

-p : 파일 권한 유지

-r : 하위 디렉토리 및 파일 모두 복사.


*대문자 P와 소문자 p 옵션이 따로 있으니 주의하고 사용!


ex) a계정으로 b.tistory.com서버 /home/c라는 폴더에 내 컴퓨터 Desktop에 있는 파일 example.txt를 전송할때

scp /Users/username/Desktop/example.txt a@b.tistory.com:/home/c

반응형

'Linux > 명령어' 카테고리의 다른 글

iconv 명령어  (0) 2015.12.29
split 명령어  (0) 2015.12.23
반응형

CentOs에 root외 ssh접속 유저 계정을 만드는 방법

Centos 6.7 (Final) version


생성 방법

1.  useradd [options] LOGIN

   ex) useradd black  -> black이라는 유저 생성

         ID에 생성할 유저 ID를 넣으면 된다.

         /home/ 폴더에 유저 폴더 생성이 된다.

options :

     -b, --base-dir BASE_DIR                          base directory for the home directory of the new account

     -c, --comment COMMENT                      GECOS field of the new account

     -d, --home-dir HOME_DIR                       home directory of the new account

     -D, --defaults                                             print or change default useradd configuration

     -e, --expiredate EXPIRE_DATE                 expiration date of the new account

     -f, --inactive INACTIVE                               password inactivity period of the new account

     -g, --gid GROUP                                          name or ID of the primary group of the new account

     -G, --groups GROUPS                                list of supplementary groups of the new account

     -h, --help                                                    display this help message and exit

     -k, --skel SKEL_DIR                                   use this alternative skeleton directory

     -K, --key KEY=VALUE                                override /etc/login.defs defaults

     -l, --no-log-init                                          do not add the user to the lastlog and faillog databases

     -m, --create-home                                   create the user's home directory

     -M, --no-create-home                              do not create the user's home directory

     -N, --no-user-group                                 do not create a group with the same name as the user

     -o, --non-unique                                      allow to create users with duplicate (non-unique) UID

     -p, --password PASSWORD                    encrypted password of the new account

     -r, --system                                               create a system account

     -s, --shell SHELL                                       login shell of the new account

     -u, --uid UID                                             user ID of the new account

     -U, --user-group                                       create a group with the same name as the user

     -Z, --selinux-user SEUSER                        use a specific SEUSER for the SELinux user mapping

2. passwd ID

    ex) passwd black -> black 유저 비밀번호 설정.

         생성한 유저 ID의 비밀번호를 설정한다.

         비밀번호가 짧고 숫자나 문자로만 되어있으면

         잘못된 암호: 너무 짧습니다  

         잘못된 암호: 너무 간단함

         라는 메세지가 출력되지만 무시하고 설정하면 비밀번호 설정이 된다.(비추)

삭제 방법

1. userdel [options] LOGIN

    ex) userdel black -> black 유저 삭제

          /home/경로에 생성된 유저 폴더는 삭제가 안된다.

options :

     -f, --force                                           force removal of files, even if not owned by user

     -h, --help                                           display this help message and exit

     -r, --remove                                      remove home directory and mail spool

     -Z, --selinux-user                              remove SELinux user from SELinux user mapping

반응형

'Linux > CentOs' 카테고리의 다른 글

CentOS 버전 확인  (0) 2016.01.18

+ Recent posts