顯示具有 ubuntu 標籤的文章。 顯示所有文章
顯示具有 ubuntu 標籤的文章。 顯示所有文章

2018年1月8日 星期一

ubuntu 改時區



Ubuntu 要改變 Timezone 時區設定,可以用以下方法:
dpkg-reconfigure
用 root 身份用 dpkg-reconfigure 設定 Ubuntu 的 Timezone, 好處是有一個選單可以選擇地區,不用記著時區的字串:
# dpkg-reconfigure tzdata
出現 “Configuring tzdata” 後,先選擇地區,亞洲地區選擇 “Asia”, 然後再選擇所在城市,按 “OK” 後便完成,同時系統會印出新的 Timezone 時區設定。
timedatectl
另一個方法是用 timedatectl,使用前先用以下指令取得 Timezone 列表:

# timedatectl list-timezones
但 Timezone 列表十分長, 用 grep 過濾會較方便, 以下只會印出亞洲區的時區:
# timedatectl list-timezones | grep Asia
找到要設定的時區後, 便可以設定:
香港時區:
# timedatectl set-timezone Asia/Hong_Kong
台北時區:
# timedatectl set-timezone Asia/Taipei
設定好後, 可以用 timedatectl 指令檢查時區是否設定正確:
# timedatectl

2017年10月24日 星期二

Ubuntu 16.04 LTS Template 要調整的東西

1. 打開  ipv4 DHCP

sudo nano /etc/network/interfaces

auto enp0s25
iface enp0s25 inet dhcp


要改成固定IP的話

auto enp0s25
iface enp0s25 inet static
address 192.168.0.16
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 8.8.4.4 8.8.8.8


2. disable ivp6 

/etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

allow root login

  1. sudo nano /etc/ssh/sshd_config
    1. change
      PermitRootLogin prohibit-password
    to
    PermitRootLogin yes 
    
    or sudo sed -i 's/prohibit-password/yes/' /etc/ssh/sshd_config
    1. in order to PAM authentication add
      AllowUsers root
    or sudo echo "AllowUsers root" >> /etc/ssh/sshd_config
    1. sudo service ssh restart
works fine
in order you don't know your root password set new with privileged user
sudo passwd root





2016年10月3日 星期一

ubuntu 16.04 squid

https://help.ubuntu.com/16.04/serverguide/squid.html

Installation

At a terminal prompt, enter the following command to install the Squid server:
sudo apt install squid3

Configuration

Squid is configured by editing the directives contained within the /etc/squid3/squid.conf configuration file. The following examples illustrate some of the directives which may be modified to affect the behavior of the Squid server. For more in-depth configuration of Squid, see the References section.
Prior to editing the configuration file, you should make a copy of the original file and protect it from writing so you will have the original settings as a reference, and to re-use as necessary. Make this copy and protect it from writing using the following commands:
sudo cp /etc/squid3/squid.conf /etc/squid3/squid.conf.original
sudo chmod a-w /etc/squid3/squid.conf.original
  • To set your Squid server to listen on TCP port 8888 instead of the default TCP port 3128, change the http_port directive as such:
    http_port 8888
    
  • Change the visible_hostname directive in order to give the Squid server a specific hostname. This hostname does not necessarily need to be the computer's hostname. In this example it is set to weezie
    visible_hostname weezie
    
  • Using Squid's access control, you may configure use of Internet services proxied by Squid to be available only users with certain Internet Protocol (IP) addresses. For example, we will illustrate access by users of the 192.168.42.0/24 subnetwork only:
    Add the following to the bottom of the ACL section of your /etc/squid3/squid.conf file:
    acl fortytwo_network src 192.168.42.0/24
    
    Then, add the following to the top of the http_access section of your /etc/squid3/squid.conf file:
    http_access allow fortytwo_network
    
  • Using the excellent access control features of Squid, you may configure use of Internet services proxied by Squid to be available only during normal business hours. For example, we'll illustrate access by employees of a business which is operating between 9:00AM and 5:00PM, Monday through Friday, and which uses the 10.1.42.0/24 subnetwork:
    Add the following to the bottom of the ACL section of your /etc/squid3/squid.conf file:
    acl biz_network src 10.1.42.0/24
    acl biz_hours time M T W T F 9:00-17:00
    
    Then, add the following to the top of the http_access section of your /etc/squid3/squid.conf file:
    http_access allow biz_network biz_hours
    
After making changes to the /etc/squid3/squid.conf file, save the file and restart the squid server application to effect the changes using the following command entered at a terminal prompt:
sudo systemctl restart squid3.service