[Raspbian] 기본 사용자인 ‘pi’ 지우기

Raspbian 설치 후에 기본 사용자인 pi를 지우고, 내 아이디를 쓰고 싶어서 지워봤다.

ssh 같은거 열면 pi로 막 들어올까봐…

모든 작업은 root로 진행했다.

 

  1. 내 ID 추가

adduser dasomoli

  1. 내 ID를 sudo 그룹으로 넣기

usermod -aG sudo dasomoli

  1. pi 사용자와 같은 그룹으로 만들기
    cat /etc/group | grep pi
    usermod -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,spi,i2c,gpio dasomoli

  2. polkit local authority 설정

vi /etc/polkit-1/localauthority.conf.d/60-desktop-policy.conf

AdminIdentities=unix-group:sudo;unix-user:0

  1. lightdm 설정

vi /etc/lightdm/lightdm.conf

autologin-user=dasomoli

  1. systemd 설정

vi /etc/systemd/system/autologin@.service

ExecStart=-/sbin/agetty –autologin dasomoli –noclear %I $TERM

vi /etc/systemd/system/getty@tty1.service.d/autologin.conf

ExecStart=-/sbin/agetty –autologin dasomoli –noclear %I $TERM

  1. 재부팅 후 내 ID로 로그인

  2. pi 지우기

deluser –remove-home –remove-all-files pi

delgroup pi

 

참고: https://www.raspberrypi.org/forums/viewtopic.php?t=202618

[Raspberry Pi] 라즈베리파이에 미디어위키(MediaWiki) 설치

라즈베리파이의 OS, Raspbian에서는 패키지를 제공하므로 매우 간단하다.

sudo apt-get install mediawiki

 

설치하면 apache2의 available configuration에 mediawiki라는 새로운 configuration(/etc/apache2/conf-available/mediawiki.conf)이 생긴다.

아래의 Alias를 풀어서 /mediawiki 로 접근해도 된다.

#Alias /mediawiki /var/lib/mediawiki

 

난 VirtualHost를 이용한다.

/etc/apache2/sites-available/wiki.dasomoli.org.conf

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName wiki.dasomoli.org

        ServerAdmin dasomoli@gmail.com
        DocumentRoot /var/lib/mediawiki

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/wiki_error.log
        CustomLog ${APACHE_LOG_DIR}/wiki.access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        Include conf-available/serve-cgi-bin.conf
</VirtualHost>

 

이제 mediawiki configuration을 enable 하자

sudo a2enconf mediawiki

wiki.dasomoli.org site도 enable하자

sudo a2ensite wiki.dasomoli.org.conf

apache2도 reload하자

sudo service apache2 reload

 

이제 wiki.dasomoli.org에 접속해서 mediawiki 설치를 시작한다.

설치가 끝나면 LocalSettings.php 파일을 저장할 수 있는데, 이 파일을 /etc/mediawiki/LocalSettings.php 로 저장한다.

다시 wiki.dasomoli.org로 접속해보면. 설치된 위키를 볼 수 있다!

 

[Linux] sudo 사용을 위한 sudoers 설정

sudo 그룹이 이미 있는 경우가 많으므로, 그냥 아래 명령을 root권한으로 주는 것이 더 낫다. 아닌 경우 그 아래 내용을 참고한다.

# usermod -aG sudo username

sudo 에 관한 설정을 바꿀 때는 /etc/sudoers 파일을 직접 고치는 것 보다는 /etc/sudoers.d/ 안에 설정 파일을 추가하는 것이 좋다.

새로운 사용자를 추가하려면 다음과 같이 파일을 추가한다.

sudo visudo -f /etc/sudoers.d/011_dasomoli-sudoer
dasomoli ALL=(ALL)   ALL

sudo를 할 때 아예 패스워드를 묻지 않게 할 수도 있는데, 라즈베리 파이3의 경우, 이를 이용해서 기본 계정의 경우 NOPASSWD: ALL 을 줘서 sudo 시 패스워드를 묻지 않도록 하고 있다.

vi /etc/sudoers.d/010_pi-nopasswd
pi ALL=(ALL) NOPASSWD: ALL

우분투 LiveCD로 grub 복구하기

매번 할 때마다 그냥 그때그때 찾아서 했는데, 이제 찾는 것도 귀찮다…..

1. Live CD로 부팅한 후 https://www.google.co.kr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCIQFjAA&url=http%3A%2F%2Fhowtoubuntu.org%2Fhow-to-repair-restore-reinstall-grub-2-with-a-ubuntu-live-cd&ei=tC1nVYDRKoalmQWr64LwAw&usg=AFQjCNEezfvAX1O1qULcr-1Cptqi-ps7Iw&sig2=lVwEJ0u7IuDDgGZfJnzjwQ&bvm=bv.93990622,d.dGY 의 내용대로 함.


요약하면, sudo gparted 하여 우분투 설치 파티션 알아냄. 거의 ext4 파티션. 나의 경우 /dev/sda4

sudo mount /dev/sda4 /mnt

sudo mount –bind /dev /mnt/dev &&

sudo mount –bind /dev/pts /mnt/dev/pts &&

sudo mount –bind /proc /mnt/proc &&

sudo mount –bind /sys /mnt/sys

sudo chroot /mnt

grub-install /dev/sda

grub-install –recheck /dev/sda

update-grub

exit &&

sudo umount /mnt/sys &&

sudo umount /mnt/proc &&

sudo umount /mnt/dev/pts &&

sudo umount /mnt/dev &&

sudo umount /mnt

2. Default 설정 등 파일은 /etc/default/grub 에 있음. 설정 바꾼 후 update-grub 하면 그대로 설정됨.

GRUB_DEFAULT=0

#GRUB_HIDDEN_TIMEOUT=0

GRUB_HIDDEN_TIMEOUT_QUIET=true

GRUB_TIMEOUT=5

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”

GRUB_CMDLINE_LINUX=””

[Ubuntu] root 인증서 설치

프록시를 사용하는 환경에서 https 프로토콜을 사용할 때 인증 오류가 나는 경우, ca-certificate 인증 문제일 경우가 많다. 프록시 사용에 따른 인증서를 제공한다면 이걸 시스템 전역적으로 설치해주면 해결된다. 절차는 간단하다.

$ sudo mkdir /usr/share/ca-certificates/extra
$ sudo cp foo.crt /usr/share/ca-certificates/extra/
$ sudo dpkg-reconfigure ca-certificates

하고나서 껐다켜야 잘 되던데? 왜그런거지..

출처: http://askubuntu.com/questions/73287/how-do-i-install-a-root-certificate