apt-get install samba
smbpasswd -a sinfo
vim /etc/samba/smb.conf

[homes] [homes]를 표기하는 경우, 각 사용자의 home directory (~/아이디)를 검색하여 그리로 연결해 줍니다.
comment 이 section (여기서는 homes)을 나타내는 주석입니다.
valid users 이 서비스에 로그인 가능한 사용자를 할당합니다.

%S는 서비스의 이름을 나타내는데 곧 samba를 사용할 권한이 있는 사용자가 됩니다.
browseable 네트워크 상에서 사용 가능한 공유 목록에 표시되게 할지 말지 정합니다.
read only guest 계정이 접근할 경우 등 필요 시 read only를 yes 해주시면 됩니다.


service smbd restart
ps -ef | grep samba

 

root@sinfo:~# ps -ef | grep samba
root        4027    4022  0 23:23 ?        00:00:00 /usr/lib/x86_64-linux-gnu/samba/samba-bgqd --ready-signal-fd=45 --parent-watch-fd=11 --debuglevel=0 -F
root        4186    2350  0 23:30 pts/0    00:00:00 grep --color=auto samba
root@sinfo:~#

 

<윈도우연결>

samba service를 체크한다.

탐색기에서 samba설치되어진 ip address를 입력 \\192.168.49.489후
samba설치시에 등록한 sinfo아이디 + password를 입력한다.
나타나는 화면은 다음과 같다.

위의 모습을 윈도우형식으로 보여준다. 윈도우처럼 복사 & 붙여넣기 사용가능

sed -i 's/\r//g' cron_batch.sh(엑셀에 의해서 일괄로 만들어진 파일)

-rw-r--r-- 1 release release  4305 2023-01-12 08:56 send_to_be_mst_kse.c?
-rw-r--r-- 1 release release  4808 2023-01-12 08:56 send_to_be_detail_data_p.c?
-rw-r--r-- 1 release release  3350 2023-01-12 08:56 send_to_be_mst_kosdaq.c?
-rw-r--r-- 1 release release  3828 2023-01-12 08:56 send_to_be_detail_data_cnt.c?
-rw-r--r-- 1 release release  2873 2023-01-12 08:56 send_to_be_data_kse.c?
-rw-r--r-- 1 release release 26977 2023-01-12 08:56 send_to_be_kse_jisu.c?
-rw-r--r-- 1 release release  3450 2023-01-12 08:56 send_to_be_trade.c?
-rw-r--r-- 1 release release  3386 2023-01-12 08:56 send_to_be_trade_for_master.c?
-rw-r--r-- 1 release release 11134 2023-01-12 08:56 send_to_be_kse_file.c?
-rw-r--r-- 1 release release 27946 2023-01-12 08:56 send_to_be_kosdaq_jisu.c?
-rw-r--r-- 1 release release 11769 2023-01-12 08:56 send_to_be_elw_file.c?
-rw-r--r-- 1 release release  4305 2023-01-12 09:22 send_to_be_mst_kse.c
-rw-r--r-- 1 release release  4808 2023-01-12 09:22 send_to_be_detail_data_p.c
-rw-r--r-- 1 release release  3350 2023-01-12 09:22 send_to_be_mst_kosdaq.c
-rw-r--r-- 1 release release  3828 2023-01-12 09:22 send_to_be_detail_data_cnt.c
-rw-r--r-- 1 release release  2873 2023-01-12 09:22 send_to_be_data_kse.c
-rw-r--r-- 1 release release 26977 2023-01-12 09:22 send_to_be_kse_jisu.c
-rw-r--r-- 1 release release  3450 2023-01-12 09:22 send_to_be_trade.c
-rw-r--r-- 1 release release  3386 2023-01-12 09:22 send_to_be_trade_for_master.c
-rw-r--r-- 1 release release 11134 2023-01-12 09:22 send_to_be_kse_file.c
-rw-r--r-- 1 release release 27946 2023-01-12 09:22 send_to_be_kosdaq_jisu.c
-rw-r--r-- 1 release release 11769 2023-01-12 09:22 send_to_be_elw_file.c
[release@nticker1 test_port_to_be]$

그리고 지우는 방법

1. 현재 디렉토리
find . -name "*.c?" -print -exec rm {} \;
find . -name "*.cpp?" -print -exec rm {} \;

find ./ -maxdepth 1 -name "*.c?" -print -exec rm {} \;
find ./ -maxdepth 1 -name "*.cpp?" -print -exec rm {} \;

2. 하위디렉토리
find ./ -name "*.c?" -print -exec rm {} \;
find ./ -name "*.cpp?" -print -exec rm {} \;

단 .cs .cc 같은 파일도 동시에 지워지므로, 아주 조심해서 사용해야 한다.
단 .cs .cc 같은 파일도 동시에 지워지므로, 아주 조심해서 사용해야 한다.
단 .cs .cc 같은 파일도 동시에 지워지므로, 아주 조심해서 사용해야 한다.
단 .cs .cc 같은 파일도 동시에 지워지므로, 아주 조심해서 사용해야 한다.

sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_OPTION/tickerplant.conf.internet.real.standby.x64.groupe
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_OPTION/tickerplant.conf.internet.real.standby.x64.groupe.relay
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_OPTION/tickerplant.conf.internet.real.standby.x64.groupe.koscom
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_FUTURE/tickerplant.conf.internet.real.standby.x64.groupd.relay
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_FUTURE/tickerplant.conf.internet.real.standby.x64.groupd
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_FUTURE/tickerplant.conf.internet.real.standby.x64.groupd.koscom
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_KSE/tickerplant.conf.internet.real.standby.x64.groupa
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_KSE/tickerplant.conf.internet.real.standby.x64.groupa.koscom
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_KSE/tickerplant.conf.internet.real.standby.x64.groupa.relay
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_KOSDAQ/tickerplant.conf.internet.real.standby.x64.groupb.koscom
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_KOSDAQ/tickerplant.conf.internet.real.standby.x64.groupb.relay
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_KOSDAQ/tickerplant.conf.internet.real.standby.x64.groupb
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_ELW/tickerplant.conf.internet.real.standby.x64.groupc.koscom
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_ELW/tickerplant.conf.internet.real.standby.x64.groupc
sed -i 's/STANDBY/ACTIVE/gi' ./INTERNET_ELW/tickerplant.conf.internet.real.standby.x64.groupc.relay



우분투 NTP 시간 동기화 설정/우분투 NTP 시간 동기화 설정/우분투 NTP 시간 동기화 설정
우분투 NTP 시간 동기화 설정/우분투 NTP 시간 동기화 설정/우분투 NTP 시간 동기화 설정
우분투 NTP 시간 동기화 설정/우분투 NTP 시간 동기화 설정/우분투 NTP 시간 동기화 설정

0.
apt-get install -y ntp

1.
root@sinfo:~# vi /etc/ntp.conf

>>주석처리
#pool 0.ubuntu.pool.ntp.org iburst
#pool 1.ubuntu.pool.ntp.org iburst
#pool 2.ubuntu.pool.ntp.org iburst
#pool 3.ubuntu.pool.ntp.org iburst
>>추가
server 1.kr.pool.ntp.org
server 1.asia.pool.ntp.org
server time.bora.net
server 203.248.240.140 iburst


2.
>>ntp 서비스 실행
root@sinfo:~#systemctl start ntp (서비스 실행)
root@sinfo:~#systemctl status ntp (서비스 상태 확인)

root@sinfo:~#
root@sinfo:~#
root@sinfo:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 1.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 2.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 3.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 ntp.ubuntu.com  .POOL.          16 p    -   64    0    0.000    0.000   0.000
 ap-northeast-2. 10.84.87.146     2 u   24   64    5    3.934   -1.094   8.041
 x.ns.gin.ntt.ne 129.250.35.222   2 u   31   64    7   35.498   -4.566   0.861
 time.bora.net   101.55.81.10     3 u   96   64    2    4.299   -3.241   0.000
-106.247.248.106 216.239.35.0     2 u   25   64    7    2.822    2.408   0.928
+121.174.142.81  220.73.142.66    3 u   23   64    7    9.265   -0.952   1.292
*193.123.243.2   125.185.190.74   2 u   25   64    7    2.322   -0.115   1.223
+send.mx.cdnetwo 125.185.190.74   2 u   23   64    7    2.355   -0.387   1.212
-ntp1.torix.ca   .PTP0.           1 u   21   64    7  177.186   -4.221   1.216
-ns2.tdc.akl.tel 202.46.178.18    2 u   18   64    7  189.169    0.644   1.666
 185.125.190.58  167.28.20.25     2 u   21   64    7  237.671   -8.107   0.991
-ntp4.flashdance 192.36.143.150   2 u   20   64    7  243.052   -4.914   1.725
 185.125.190.57  167.28.20.25     2 u   20   64    7  239.424   -7.351   0.919
-magnat.ip-conne 31.28.161.68     2 u   21   64    7  268.196  -10.977   1.606
 alphyn.canonica 142.3.100.2      2 u   24   64    7  206.479   11.904   0.847
 pugot.canonical 17.253.108.125   2 u   17   64    7  255.509    1.233   1.575
 185.125.190.56  179.208.94.190   2 u   21   64    7  232.582   -6.133   1.044



4.
UTC(협정 세계시)로 설정됨

root@sinfo:~# date
Sat 31 Dec 2022 06:19:36 AM UTC
root@sinfo:~#
root@sinfo:~#
root@sinfo:~#



5. 
서울 시간(KST)로 변경 해 됨겠습니다.
root@sinfo:~# timedatectl set-timezone Asia/Seoul
root@sinfo:~# date
Sat 31 Dec 2022 03:20:11 PM KST
root@sinfo:~#
root@sinfo:~#

Linux sinfo 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

1.1
1.  swap(2,048)  -> 10,000
2.  /boot(100)   ->  2,000
3.  /(3,072)     -> 12,000
4.  /usr(8,192)  -> 70,000
5.  /usr2(90,000)-> 90,000
6.  /var(4,096)  -> 12,000
7.  /tmp(4,096)  -> 12,000
8.  /data(70,000)-> 70,000
9.  /home(2,000) ->  2,000
10. /web(나머지 부분을 할당, 체크)

2.1
sudo passwd root

3.2
userdel sinfo

groupadd other
useradd -d /usr2/sinfo -s /bin/bash -g other -m sinfo
passwd sinfo

4.1
$apt install telnetd -y
$systemctl status inetd

5.1
$apt-get install vsftpd
$systemctl restart vsftpd
$vi /etc/vsftpd.conf
/*------------------------------------
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
local_root=/data/ftp/files
write_enable=YES
local_umask=022
dirmessage_enable=YES
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
------------------------------------*/
/*------------------------------------
write_enable=YES
write_enable=YES
write_enable=YES
write_enable=YES
------------------------------------*/
$systemctl restart vsftpd

6.1
$gcc --version
$apt update
$apt install build-essential

7. 원하는 버전의 gcc 설치
$apt -y install gcc-7 g++-7 gcc-8 g++-8 gcc-9 g++-9

8. gcc default 설정 (명령어 뒤 700, 800, 900은 임의 숫자 적용)

$update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700
$update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 700 
$update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800
$update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 800
$update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900
$update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 900

9. default 설정 확인 및 변경
$update-alternatives --config gcc
$update-alternatives --config g++

root@sinfo:~# update-alternatives --config gcc
There are 3 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path            Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gcc-9   900       auto mode
  1            /usr/bin/gcc-7   700       manual mode
  2            /usr/bin/gcc-8   800       manual mode
  3            /usr/bin/gcc-9   900       manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/gcc-7 to provide /usr/bin/gcc (gcc) in manual mode


root@sinfo:~# update-alternatives --config g++
There are 3 choices for the alternative g++ (providing /usr/bin/g++).

  Selection    Path            Priority   Status
------------------------------------------------------------
* 0            /usr/bin/g++-9   900       auto mode
  1            /usr/bin/g++-7   700       manual mode
  2            /usr/bin/g++-8   800       manual mode
  3            /usr/bin/g++-9   900       manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/g++-7 to provide /usr/bin/g++ (g++) in manual mode

10.
source ~/.bash_profile
source ~/.bashrc

>등록
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-3.3
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9

>선택
update-alternatives --config g++ 

#create
alias exe='cd /usr2/sinfo/exe/'
alias shell='cd /usr2/sinfo/exe/shell'
alias src='cd /usr2/sinfo/src/'
alias log='cd /usr2/sweb/logs/receive/'
alias manage='cd /usr2/sweb/data/manage/'

source ~/.bashrc

etc>
-bash-3.00$ source .bashrc_backup
-bash: .bashrc_backup: line 7: syntax error: unexpected end of file


-bash-3.00$ file /home/www/work/.bashrc
/home/www/work/.bashrc: ASCII text, with CRLF line terminators



-bash-3.00$ perl -pi -e "s/\r//g" .bashrc
-bash-3.00$ file .bashrc
.bashrc: ASCII text
-bash-3.00$ source .bashrc


#delete
unalias exe
unalias shell
unalias src
unalias log
unalias manage

>>>>> .bashrc 와 .bash_profile 의 차이

1) bash 쉘(Shell) 이란?
쉘(Shell)은 운영체제에서 **사용자가 입력하는 명령을 읽고 해석하여 대신 실행해주는 프로그램**입니다. 
운영체제 상에서 다양한 운영체제 기능과 서비스를 구현하는 인터페이스를 제공하며, 사용자와 운영체제의 내부(커널)` 사이의 인터페이스를 감싸는 층이기 때문에 셸이라는 이름이 붙었습니다. 
쉘은 운영체제에서 필수적으로 존재합니다.

운영체제는 로그인한 사용자가 없다면 하나의 쉘도 실행되지 않은 상태이며, 
사용자가 로그인을 시도하면 운영체제는 ID와 패스워드를 받아들이는 로기은 프로그램을 실행하고, 
사용자가 입력한 ID와 패스워드를 검증한 후 인증된 사용자라면 쉘을 실행하여 사용자 세션을 쉘에게 전달합니다.

쉘의 역할은 사용자가 입력한 명령을 해석하여 대신 실행해주는 것입니다. 
쉘의 내부 명령어라면 스스로 실행한 뒤 화면에 표시해주고 내부 명령어가 아니라면 PATH 환경변수에 
지정된 경로에서 입력받은 명령과 같은 파일을 찾아 exec() 시스템콜을 호출하여 실행한 뒤 
키보드와 마우스 등의 입력장치와 모니터에 해당하는 표준 출력장치의 제어권을 해당 프로그램에 넘겨준 뒤 프로그램이 끝날 때 까지 대기하는 역할을 합니다.

bash 쉘은 유닉스에서 사용하는 커맨드 쉘의 일종으로 GNU 프로젝트를 위해 만들어졌습니다. 
초기의 유닉스 쉘인 본 쉘(Bourne Shell)과 새로 태어났다는 뜻의 영어 ‘born again’을 합쳐 **본 어게인 쉘(Bourne-again Shell)**이라고 불렸으나, 
일반적으로 bash로 줄여 부릅니다.

2) Login Shell 과 Non-Login Shell

Login Shell
Login은 ID와 패스워드를 입력해서 Shell을 실행하는 것을 말합니다. 따라서 ssh로 접속하거나 로컬에서 GUI를 통해 Shell을 실행하는 것은 Login Shell 입니다.
.profile, .bash_profile 이 두 파일은 Login할 때 로드되는 파일입니다. .profile은 꼭 bash가 아니더라도 로그인하면 로드되며, .bash_profile은 꼭 bash로 로그인 할 때만 실행됩니다.

Non-Login Shell
Non-Login Shell은 로그인 없이 실행하는 Shell을 말합니다. ssh로 접속하고 나서 다시 bash를 실행하는 경우나, GUI 세션에서 터미널을 띄우는 것도 여기 해당합니다. ‘sudo bash’나 ‘su’같은 것도 해당합니다.

.bashrc 와 .bash_profile 의 차이
.bashrc
이미 로그인 한 상태에서 새 터미널 창을 열 때마다 로드됩니다. (Non-Login Shell에서 실행됩니다.)

.bash_profile
시스템에 로그인할 때마다 로드됩니다. (Login Shell에서 실행됩니다.) 대부분 개별 사용자에 대한 설정에 대한 코드들이 들어갑니다. 예를 들면 nvm(Node Version Manager)은 기본적으로 nvm을 사용하지 않고 Node를 설치할 때와는 다르게 각 사용자의 경로에 설치되게 되는데, 이럴때 nvm의 PATH를 .bash_profile 파일에 기재합니다.

.profile
로그인할 때 로드됩니다. 개별 사용자에 대한 설정 코드들 중 bash와는 관계없는 부분을 기재합니다.

만약 Mac에서 새 터미널 창을 열 때마다 .bashrc를 로드하고 싶다면 .bash_profile에서 .bashrc를 로드하면 됩니다.

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

+ Recent posts