1、防火墙开启相关端口

sudo ufw enable               #开启ufw

sudo ufw default deny      #关闭外部对本机的所有访问

sudo ufw allow 137

sudo ufw allow 138

sudo ufw allow 139

sudo ufw allow 445

ufw相关操作请查看 http://wiki.ubuntu.org.cn/UFW防火墙简单设置

ufw补充:sudo ufw allow from 192.168.2.0/24 to any port 21   #允许某个IP访问某个端口

2、设置要共享的文件夹权限

chmod 0777 TEMP

3、写配置

[global]

workgroup = WORKGROUP

netbios name = IT-TEST

server string = it-test

display charset = utf-8

dos charset = cp936

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

dns proxy = no

template shell = /bin/false

winbind use default domain = no

security = user

encrypt passwords = yes

smb passwd file = /etc/samba/smbpasswd

name resolve order = lmhosts bcast host

#hosts allow 表示允许哪些网段可以访问

[homes]                              #[homes]表示家目录,不是共享文件夹名称

comment = user home directories

browseable=no        #不允许别人查看

writable = yes           #允许登陆用户读写

[temp]

comment = read write

path = /media/TEMP

writeable = yes

public = yes

write list=@test1                                       #表示组成员可访问

#valid users = test001,test0022            #设置某些用户可访问

#only guest=yes 表示采用nobody也就是guest的权限登陆。

create mode = 0666

directory mode = 0777

4、新建 smbpasswd文件

smbpasswd默认是没有的,通过smbpasswd -a等添加用户后就有了。

samba的用户首先必须是系统用户,也就是/etc/passwd里面有的,然后才能成为samba用户

备注:是系统用户不一定就能登陆系统。

smbpasswd的操作就4个命令

smbpasswd -a 添加用户

smbpasswd -x 删除用户

smbpasswd -e 启用用户

smbpasswd -d 禁用用户

5、添加系统账户、群组

1>添加群组 :sudo groupadd  test1

2>添加账户:

sudo useradd -M -s /sbin/nologin -d /dev/null -g test1  test001    

#加入群组,只用于登陆samba,不登陆系统,不建家目录,

6、给samba添加用户

sudo smbpasswd -a test001              #这个用户名必须和上面的对应起来。要输入两遍密码

7、smb相关命令

smbstatus:服务端查看连接到本服务器的连接状态

smbclient -L //IP :查看资源列表

smbclient //IP -U user :使用用户身份登陆到samba服务器,然后使用ftp命令上传下载文件

smbmount //IP /mnt/share -o username=user    挂在共享文件夹到本地 。参数同mount

mount -t smbfs //IP /mnt/share -o username=user

以上2013.10.09更改,接下去学习smb.conf配置文件。

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
    # 端口号
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
    #监听服务器的哪个网卡的ssh联机
#ListenAddress ::
#ListenAddress 0.0.0.0
    #使用的协议
Protocol 2
# HostKeys for protocol version 2
    #服务器密钥存放地址
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
    #v1的key存活时间
KeyRegenerationInterval 3600
    #公钥的长度
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
    #是否允许root登录
PermitRootLogin no
    #用户的host key改变时就不接受联机
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
    #不用密码即可登录
AuthorizedKeysFile    %h/.ssh/authorized_keys

# Don’t read the user’s ~/.rhosts and ~/.shosts files
    #取消.rhosts来做认证
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don’t trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
    #不允许空密码登录
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to ‘yes’ to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of “PermitRootLogin without-password”.
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to ‘no’.
UsePAM yes

1、用sftp 上传sources.list
      sftp server用户名@server主机名
      输入 server用户名的密码

    put /etc/apt/sources.list /etc/apt/.

(ssh 的使用查看上一篇: 从网络接手server:2、ssh到server)

2、更新源
     exit
    ssh server用户名@server主机名
   输入 server用户名的密码

   sudo apt-get update

1、防火墙开放22端口
      sudo ufw allow 22    (开放22端口)
      sudo ufw status        (查看ufw状态)

2、连接到server
      ssh server的用户名@server主机名     (server主机名我连不了,我用IP才连上去)
      sftp server的用户名@server主机名

其他:

查看日志 grep sshd /var/log/auth.log

设置ssh不允许用root用户

nano /etc/ssh/sshd_config

更改PermitRootLogin no 即可

3、端口敲门:

服务器端:

 sudo apt-get install knockd

配置knockd.conf

[options]

UseSyslog

  #使用/var/log/syslog

[openSSH]

sequence    = 7000,8000,9000

  #敲门端口号

seq_timeout = 5

  #敲门需在5秒内完成

command     = /sbin/iptables -I INPUT 1 -s %IP% -p tcp –dport 22 -j ACCEPT

  #-I INPUT 1:插入到iptable第一行

  #-s %IP%   :目标IP地址

  #-p tcp    :对应tcp协议

  #--dport 22  :要连接的22端口

  #-j ACCEPT   :允许通过

  #合起来就是: 在第一行插入一条规则:允许该IP通过tcp为22的端口

tcpflags    = syn

  制定tcp数据包标记

[closeSSH]

seq_timeout = 5

    #等待5秒再执行关闭命令

command     = /sbin/iptables -D INPUT -s %IP% -p tcp –dport 22 -j ACCEPT

tcpflags    = syn

客户端:

sudo apt-get install knockd

knock IP 7000 8000 9000; ssh user@IP

http://www.ibm.com/developerworks/cn/aix/library/au-sshlocks/index.html

附:
1、第一次连接会提示是否连接点是
2、提示输入密码,要输入server用户名的密码

sudo apt-get install gpm 即可
右击表示粘帖

1、BIOS设置:
         power manager setup —> wake-up by LAN/Ring —> enable

2、系统开启远程唤醒功能:
         1> 安装ethtool

sudo apt-get install ethtool

          2>开启唤醒功能

查看:sudo ethtool eth0

wake-on 为g时已开启,d表示禁用

设置:sudo ethtool -s eth0 wol g

在rc.local里加入一句     ethtool -s eth0 wol g (这样每次启动就不用重新设置了)

          3>记录MAC地址:ifconfig 

 3、从本机网络启动server
            1>安装wakeonlan  sudo apt-get install wakeonlan
            2>开启命令 wakeonlan MAC

参考:http://hi.baidu.com/liuweigang525/blog/item/d0ccf902c4ec83e208fa93eb.html

sudo vim /etc/default/locale

将下面的内容修改

LANG=”zh_CN.UTF-8”

LANGUAGE=”zh_CN:zh”

修改为:

LANG=”en_US.UTF-8”

LANGUAGE=”en_US:en”

 sudo vim /var/lib/locales/supported.d/local

改成

en_US.UTF-8 UTF-8

重启  sudo locale-gen

-——————————————————————————————

若出现如下问题

        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = “zh_CN.UTF-8”

运行:
debian:# apt-get install locales
debian:
# dpkg-reconfigure locales
debian:~# locale

摘录自: http://www.sudu.cn/info/article/articleInfo.php?aId=288137

1、股票盘整了三周 多空多消耗的很厉害,肯定会有转折
1、大盘周线又一次逼近半年线,会有回调

2、光大网上申购,会有大量资金流出

不是哪只股会涨就好,要把资金充分利用起来
选就选唯一的那只最有潜力的股

在正常模式下把桌面改到d盘中去,

具体如下:先在d盘建一个文件夹,

然后点开始—〉运行—〉regedit,

点击HKEY_CURRENT_USER–〉Software–〉Microsoft–〉Windows–〉CurrentVersion–〉Explorer–〉user Shell Folders

双击右边的dosktop,弹出一个对话框,

在数据数值里写上你想存到那个文件夹的路径(就是打开文件夹,上面地址栏里的那行字),

确定,关闭。注销系统就ok了。以后桌面上的东西就都在d盘里了