2012. 12. 7. 15:33

http://www.cmsfactory.net/node/62

Fedora 16부터는 서비스(Service) 관리를 systemctl이라는 명령어로 합니다. 이전 명령어들도 사용할 수 있지만 systemctl 사용을 권장하고 있습니다. systemctl 명령어의 주요 사용법을 정리합니다.

서비스 상태 확인 하기

서비스 상태 확인은 다음과 같이 합니다.

systemctl status service_name.service

예를 들어 httpd의 상태를 확인하려면 다음과 같이 명령합니다.

systemctl status httpd.service

서비스 시작, 중지, 재시작 하기

서비스를 시작하는 기본 명령 방식은 다음과 같습니다.

systemctl start service_name.service

중지할 때에는 start 대신 stop, 재시작할 때에는 restart를 쓰면 됩니다. 예를 들어 httpd를 시작하려면 다음과 같이 명령한다.

systemctl start httpd.service

중지와 재시작은 다음과 같이 명령하면 된다.

systemctl stop httpd.service
systemctl restart httpd.service

부팅 시 자동 실행 하기

시스템 부팅 시 서비스가 자동 실행되게 하는 명령은 다음과 같습니다.

systemctl enable service_name.service

예를 들어 httpd를 부팅 시 자동 실행되게 하려면 다음과 같이 명령합니다.

systemctl enable httpd.service

자동 실행 되지 않게 하려면 enable 대신 disable을 쓰면 됩니다.

실행 중인 서비스 보기

실행 중인 모든 서비스 목록을 보려면 다음과 같이 명령합니다.

systemctl list-units --type=service

 

 

http://www.howtoforge.com/fedora-17-samba-standalone-server-with-tdbsam-backend

 

1 Preliminary Note

I'm using a Fedora 17 system here with the hostname server1.example.com and the IP address 192.168.0.100.

Please make sure that SELinux is disabled:

Edit /etc/selinux/config and set SELINUX=disabled:

vi /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

Afterwards we must reboot the system:

reboot

2 Installing Samba

Connect to your server on the shell and install the Samba packages:

yum install cups-libs samba samba-common

Edit the smb.conf file:

vi /etc/samba/smb.conf

Make sure you see the following lines in the [global] section:

[...]
# ----------------------- Standalone Server Options ------------------------
#
# security = the mode Samba runs in. This can be set to user, share
# (deprecated), or server (deprecated).
#
# passdb backend = the backend used to store user information in. New
# installations should use either tdbsam or ldapsam. No additional configuration
# is required for tdbsam. The "smbpasswd" utility is available for backwards
# compatibility.
#

        security = user
        passdb backend = tdbsam


[...]

This enables Linux system users to log in to the Samba server.

Then create the system startup links for Samba and start it:

systemctl enable smb.service
systemctl start smb.service

3 Adding Samba Shares

Now I will add a share that is accessible by all users.

Create the directory for sharing the files and change the group to the users group:

mkdir -p /home/shares/allusers
chown -R root:users /home/shares/allusers/
chmod -R ug+rwx,o+rx-w /home/shares/allusers/

At the end of the file /etc/samba/smb.conf add the following lines:

vi /etc/samba/smb.conf

[...]
[allusers]
  comment = All Users
  path = /home/shares/allusers
  valid users = @users
  force group = users
  create mask = 0660
  directory mask = 0771
  writable = yes

If you want all users to be able to read and write to their home directories via Samba, add the following lines to /etc/samba/smb.conf (make sure you comment out or remove the other [homes] section in the smb.conf file!):

[...]
[homes]
   comment = Home Directories
   browseable = no
   valid users = %S
   writable = yes
   create mask = 0700
   directory mask = 0700

Now we restart Samba:

systemctl restart smb.service

4 Adding And Managing Users

In this example, I will add a user named tom. You can add as many users as you need in the same way, just replace the username tom with the desired username in the commands.

useradd tom -m -G users

Set a password for tom in the Linux system user database. If the user tom should not be able to log into the Linux system, skip this step.

passwd tom

-> Enter the password for the new user.

Now add the user to the Samba user database:

smbpasswd -a tom

-> Enter the password for the new user.

Now you should be able to log in from your Windows workstation with the file explorer (address is \\192.168.0.100 or \\192.168.0.100\tom for tom's home directory) using the username tom and the chosen password and store files on the Linux server either in tom's home directory or in the public shared directory.

5 Links

 

 

 

 

 

Posted by eoseontaek