(1) 마운트할 디렉토리 생성

mkdir share_public

(2) 마운트할 대상 서버 연결

sudo mount -t cifs -o username=john //110.110.110.110/share /home/john/share_public

(3) unmount 방법

sudo unmount /home/john/share_public

Posted by Marvin moon
,

# apt-get install apcupsd


설정파일인 /etc/apcupsd/apcupsd.conf 


다음과 같이 변경한다.

UPSCABLE usb
UPSTYPE usb
DEVICE
LOCKFILE /var/lock
UPSCLASS standalone
UPSMODE disable


/etc/default/apcupsd 에서 ISCONFIGURED 값을 no 에서 yes 로 변경 해준뒤, /etc/init.d/apcupsd 를 실행


apcaccess를 통해 체크 

만약  apcupsd @ localhost:3551: Connection refused 와 같은 에러 메세지가 나올 경우 

(1) ps -ef | grep apcupsd 확인


(2)  서버 또는 PC를 재부팅 이나 USB 포트를 다른 포트에 꽂으면 해결된다.


Posted by Marvin moon
,
SSH의 포트 공격에 대비한 22번 포트를 변경해 보도록 하겠습니다.

Ubuntu 9.10 대상입니다. 하지만 다른 버전도 똑같을 것으로 판단되니.. 그냥 하시면 되겠습니다.

ssh_config file : 클라이언트 툴의 접근에 대한 설정 파일
sshd_config file : ssh 데몬 설정을 위한 설정 파일

임의로 설정합니다. 저는 5000으로 예를 들겠습니다.
(수정될 포트의 번호는 임의로 정하셔도되며 1024번보다 상위 포트로 지정합니다)

# vi /etc/ssh/ssh_config <- ubuntu의 경우 거의 다 주석처리 되어 있으므로 패스하시면 됩니다.
Port 5000 <-- 변경
# vi /etc/ssh/sshd_config <- ubuntu의 경우 이녀석만 바꿔주면 합니다.
Port 5000 <-- 변경
ListenAddress xx.xxx.xx.xx <-- 0.0.0.0를 server ip로 변경 <- ubuntu의 경우 주석 부분임 

sshd 데몬 재실행 합니다.
1) standalone 일때
# /etc/init.d/sshd restart
2) init 일때
# /etc/init.d/xinetd restart
수정된 포트확인을 합니다.
# netstat -na|grep :5000 tcp 0 0 xx.xxx.xx.xx:5000 0.0.0.0:* LISTEN

방화벽(iptables)가 설정되어 있다면, 열어준 해당 포트를 열어 주어야 합니다

(tcp, udp 둘 다 5000를 열어 줍니다.)

외부 접근시..(공유기에 여러대의 리눅스 머신을 물려두었을때..연구실등 or 별도의 ssh 접속 프로그램을 사용 안할시...)
> ssh test@xx.xxx.xx.xx -p 5000
Password:
Last login: Mon Feb 15 00:18:56 2011 from xx.xxx.xx.xx
Hi Welcome!! xxx's...
>
Posted by Marvin moon
,
우분투에서 update와 upgrade 차이점에 대해 설명드리면

sudo apt-get update
패키지 목록을 갱신하는 명령어

sudo apt-get upograde
업그레이드할 패키지를 체크하여 해당 모듈을 Upgrade 함.

Posted by Marvin moon
,

특별한 이유로 FTP로 다른 디렉토리를 접근하려고 아래와 같이 심볼릭 링크를 만들었습니다.

prompt> cd /home/ftpdata
prompt> ln -s /home/dykim/mydata

FTP로 접근해서 mydata를 접근하려면 아래와 같은 에러만 발생합니다.

ftp> cd mydata
550 /Mp3: No Such file or directory

보안상의 이유로 많은 FTP 서버가 심볼릭 링크를 허락하지 않는다고 합니다.


해결방법

이런 경우 단순히 심볼릭링크로 되지 않고 FTP가 접근할 수 있는 디렉토리에 내가 접근할 디렉토리를 마운트하면 가능합니다. 이럴 경우 root에 상응하는 권한이 필요합니다.

prompt> cd /home/ftpdata
prompt> mkdir mydata
prompt> sudo mount -o bind /home/dykim/mydata /home/ftpdata/mydata
Posted by Marvin moon
,
새 하드디스크 추가후 파티션과 포멧을 진행 한 후 /etc/fstab 파일에
부팅시 자동으로 마운트 되도록 mount 정보를 추가해야 한다.
여기서 중요한 것이 새로 추가된 HDD의 UUID 정보를 정확하게 입력해야만 한다.

다음과 같은 명령어로 UUID 값을 얻어 올 수 있다.

#sudo blkid /dev/sd1(device name)


Posted by Marvin moon
,
하드디스크 새로 설치할때 사용하는 방법입니다.
아래 방법은 Console로 작업시 유용한 방법이며, 쉬운 방법은 gparted를 사용하여 설치하는 방법입니다.
gparted 설치 방법은 추후 포스팅 하도록 하겠습니다.

 

디스크 및 파티션 정보 보기

sudo fdisk -l
Disk /dev/sda: 18.3 GB, 18351959040 bytes
255 heads, 63 sectors/track, 2231 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 12 96358+ 83 Linux
/dev/sda2 13 255 1951897+ 82 Linux swap / Solaris
/dev/sda3 256 2231 15872220 83 Linux

Disk /dev/sdb: 73.4 GB, 73407900160 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 8924 71681998+ 8e Linux LVM <--- 한개도 안잡혀있는 sdb1 디스크

파티션 할당하기

  sudo fdisk /dev/sdb1
root@ubuntu:/var# fdisk /dev/sdb1
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 8923.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help):

 

Command (m for help): n
Command action
e extended
p primary partition (1-4)

Partition number (1-4): 1
First cylinder (1-8923, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-8923, default 8923): 8923
Command (m for help): w

리부팅

디스크 정보 할당을 위하여 리부팅한다.

 reboot

파티션 포맷

  sudo mkfs.ext3 /dev/sdb1
 
root@ubuntu:/var# mkfs.ext3 /dev/sdb1
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
8962048 inodes, 17920499 blocks
896024 blocks (5.00%) reserved for the super user
First data block=0
547 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

마운트할 위치 만들기

mkdir /home1

마운트하기

mount /dev/sdb1 /home1

자동 마운트 설정

  /etc/fstab 파일을 편집
 [파티션] [마운트] ext3 defaults,errors=remount-rw 0 1
  #
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/sda3 / ext3 defaults,errors=remount-ro 0 1
/dev/sda1 /boot ext3 defaults 0 2
/dev/sda2 none swap sw 0 0
/dev/hda /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/sdb1 /home1 ext3 defaults,erros=remount-rw 0 1
/dev/hda /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0

 

정보 새로고침

 sudo mount -a

GUI로 된 디스크관리 매니저를 설치

 sudo apt-get install gparted
Posted by Marvin moon
,

(1) 실행하고자 하는 스크립 파일을 /etc/init.d 디렉토리에 생성한다
/etc/init.d/ xxx.sh 생성

(2) 해당 스크립파일의 퍼미션 변경
sudo chmod 755 xxx.sh

(3) 해당 스크립파일을 부팅시 실행되도록 등록한다.
update rc.d xxx.sh defaults
Posted by Marvin moon
,
. 설치
$ sudo apt-get install subversion


2. 사용

2.1 repository 만들기

원하는 위치에 repository 디렉토리를 생성한다. repository 디렉토리는 모든 소스들이 svn에 저장될 위치이다. warnus는 필자의 개인 계정이다.

$ mkdir /home/warnus/repo


여기에 프로젝트 별로 개별 저장소를 만들 수 있다.

$ svnadmin create --fs-type fsfs /home/warnus/repo/sample



2.2 SVN Repository 접근방식 설정

2.2.1 패스워드 접근 설정과 계정 설정

$ vim /home/warnus/repo/sample/conf/svnserve.conf

내용을 보면 섹션이 나눠져 있는데 [general] 섹션에 다음을 입력한다.

password-db = passwd

ex)

[general]
password-db = passwd

이제 접속 가능한 유저를 설정하는 부분이다.

$ vim /home/warnus/repo/sample/conf/passwd

#username = passwd
사용자이름 = 패스워드

사용자 이름과 패스워드를 입력하면 된다.

ex)

warnus = 12345


2.2.2 SVN 서버 실행

SVN 접속 방식은 SVN 서버를 통해 접근하는 것으로 서버를 실행 시켜야한다.

$ svnserve -d -r /home/warnus/repo

서버가 제대로 동작하는지 확인하려면 다음 명령을 사용한다.

$ netstat -na | grep 3690

3690은 SVN의 기본 포트 번호이다.


이제 기본으로 사용하는 trunk, branches, tags 디렉토리를 생성한다.

$ svn mkdir svn://localhost/sample/trunk --username warnus
$ svn mkdir svn://localhost/sample/branches --username warnus
$ svn mkdir svn://localhost/sample/tags --username warnus

각각의 디렉토리를 생성할 때 코멘트를 입력하게 하는데 별다른 내용 없이 에디터 창을 닫아도 된다.
그후 사용자 인증에 관한 질의가 있는데 'yes' or 'no' 로 답변하는 부분이 있다.

yes를 아무리 눌러도 계속 질문하는 경우엔 한글로 '예' 라고 입력하자.


2.3 프로젝트 import

프로젝트를 저장소에 넣기 위한 작업을 하자.

먼저 테스트하기 위해 임의의 프로젝트를 생성해보자. (import는 디렉토리 단위로 할 수 있다.)

$ mkdir myproject

sample.c 생성

int main(void)
{
    printf("Hello SVN\n");
}


위 파일이 생성 완료 되었다면 import 해보자.

$ svn import myproject svn://localhost/sample/trunk --username warnus





2.4 checkout 하기

저장소에 올려둔 소스를 가져오고 싶으면 checkout 하면 된다.

$ svn checkout svn://localhost/sample/trunk ./



2.5 update

수정된 내역을 update 하고 싶으면 이전에 checkout 해둔 곳에서 다음 명령 입력

$ svn update

2.6 commit
 
소스 수정 후 commit 하고 싶으면 다음 명령을 입력

$ svn commit


2.7 Log 확인

저장소에서 어떤 내용이 변경되었는지 확인하려면 다음 명령을 입력

$ svn log
Posted by Marvin moon
,
1. samba 개요
samba는 윈도우와 리눅스간에 파일을 공유 할 수 있는 방법을 제공해 주는 프로그램이다.


2. samba 설치

 $ sudo apt-get install samba


3. samba 설정
우분투 samba 의 기본설정은 리눅스의 계정id와는 별도로 설정된다. 따라서 samba의 사용자를 다시 설정해 줘야 한다. samba id를 만들때는 사용계정의 id와 같게 만들어 주는게 좋다. 이것은 접속시에 해당 리눅스 계정과 매치되기 때문이다. 즉 자신이 aaa라는 id를 사용하고 있다고 하면 samba id도 aaa로 만들어 주는게 좋다는 것이다. 다음과 같이 id를 만든다.

 $ sudo smbpasswd -a 계정ID

이를 실행하면 passwd를 물어 본다.
윈도우에서 접근시에는 계정패스워드(리눅스 로그인시 패스워드)가 아니라 여기서 입력한 passwd를 사용한다.


4. smb.conf 수정
/etc/samba/smb.conf 파일을 수정한다.
파일의 끝부분에 Share Definitions의 [homes]의 주석을 푼다.

[homes]
comment = Home Directories
browsable = no

read only = no


5. samba 재시작

 $ sudo /etc/init.d/samba restart
Posted by Marvin moon
,