Author: coolguy
windows特有软件-AdvanceSystemCare
-
Advanced SystemCare
Advanced SystemCare是一款能分析系统性能瓶颈的优化软件。它通过对系统全方位的诊断,找到系统性能的瓶颈所在,然后有针对性地进行修改、优化。优化后系统性能和网络速度都会有明显提升。
- 平常使用的时候感觉不错,就记录一下。
mac系统问题和优化-显示隐藏文件的脚本
mac系统默认情况下无法查看隐藏文件,如果有需要可以使用脚本,显示隐藏文件。
脚本源代码如下:
display dialog "隐藏/显示隐藏文件" buttons {"可见", "隐藏"} with icon 2 with title "Switch to presentation mode" default button 1
set switch to button returned of result
if switch is "隐藏" then
do shell script "defaults write com.apple.finder AppleShowAllFiles -bool false;
KillAll Finder"
else
do shell script "defaults write com.apple.finder AppleShowAllFiles -bool true;
KillAll Finder"
end if
复制脚本源代码,然后 打开 Launchpad —>其他—>Script Editor
复制代码然后运行就可以了。或者选 文件 导出 成 application 也可以。
坑爹生活反思-网站目录与文章标题的思考
隐藏的文章需要配置的地方:
1、UAM 配置
2、自动展开 category 目录 配置
3、Popular post 配置
4、recent psot 不需要 配置
网站目录分类说明:
1、二级分类会带有一级分类的名字,这样做是为了在文章后台更加清晰的,识别与管理。因为后台只会展示二级分类名,这样做为了避免存在同名二级分类却一级分类不同的情况。
2、各系统中 的软件被分为2类
(1)、面向多数用户的。(这部分软件,独自建立分类目录)
(2)、面向自己本人的。(这部分软件,分两类 1,跨平台的,归类到系统通用。2,不跨平台的归类到系统特有自用软件)
3、取文章标题时,会加入分类名作为前缀,这样做方便区分和管理。如果一个前缀分类名不好区分,标题中需要附加另一个前缀名,以增加文章的区分度。标题取名时,最多24个字,方便好看易于管理。27感觉也行吧。
一级分类下的问章,就直接取名:一级分类+标题
二级分类下的文章,就直接取名:二级分类+(需要区分加一级分类)+标题
4、关于前端技术文章的分类看法:
移动端按系统来分:按系统来分,可以梳理系统各个模块的划分,然后关于 语言分类问题,可以在 最终的文章上,最前端加语言标记,java-安卓Service-标题。kotlin-安卓Service-标题。这样做的目的,可以不破坏系统的介绍的完整性。然后文章按标题分类时,按首字母分类,可以很快的区分两种语言。同理,Ios的Objective-C和Swift 也可以参照此法进行系统的分类。
桌面端按框架来访:这样子,可以针对各种web前端框架进行梳理和分析,文章分类比较合理点。
5、关于流水账与日期明确的文章,采用 分类-年月-标题 来划分文章 比较好看。
时间导向性文章,还是这样操作比较好。分类的话,只用时间分类的话,可能会有后台混淆,还是采用 分类-日期的方式吧。
6、新增加了:
百科随记,用于分类记录 之前没有归类过的 流水账。(百科随记 主要侧重 网络获取的知识)
生活摘记,主要侧重于记录 日常生活。
健康贴士,单独建立分类,用于整理关于健康的小贴士文章,初步打算根据影响因素分类。
一般提到的只有四个危险因素
意见建议:1、环境因素:包括生物因素(致病性微生物、细菌、病毒、真菌、原虫以)及物理、化学、社会、经济、文化教育、就业等因素。
2、个人行为生活因素:包括营养、风俗习惯、嗜好(吸烟、酗酒)、交通工具(如汽车所带来的车祸)、体育锻炼、心理、精神状态等。
3、医疗卫生服务的因素:医疗质量低、误诊漏诊、医院交叉感染等都是直接危害健康和影响医疗质量的因素。
4、人类生物遗传因素
【最终,健康贴士 我采用 衣食住行 的方式 进行了 分类】
7、关于一类分类取名的问题,如果一类分类取名不会和其他分类的一类分类名混淆,可以直接取名,会混淆的话,还是用 主分类名-一类分类名 吧(关于一级分类名,有些时候别取木头了,健康贴士-饮食 ,还不如 直接取名:健康饮食,这样直观明了还简单 )
二级分类取名就是 就是包括 两个名了,中间 – 连接
主要是wordpress太渣了,后台文章分类只显示 子分类,无法追加父分类。所以容易对文章 归属 混淆。
关于一类分类下文章:本可根据 另一个关键字,建立二类 目录,但是二类目录文章少的话,
直接利用 文章取名 一类分类名-二类可分类关键字-文章标题
举例 疾病循环系统-高血压-标题名 (本来可以起高血压分类名字的,但是感觉文章少,直接采用这种方法了)
二级目录还是要拆分,因为看到文章标题,我不知道是哪个目录来的文章
技巧百科生活-长尾夹的用处
wordpress-好用插件介绍
一、系统安全类
1、Wordfence Security
wordpress 老牌 防火墙插件,必装。
2、Google Authenticator
wordpress 后台登录两步验证插件,提升安全性。
3、Disable XML-RPC / Disable XML-RPC Pingback
关闭远程调用接口,接口是为移动端发博客调用的,但会被黑客利用,所以jing
二、系统优化类
1、EWWW Image Optimizer
对上传的图片进行压缩的插件。
2、W3 Total Cache
建立网站缓存的插件。
3、Accelerated Mobile Pages
AMP 网站搜索,文章迅速加载插件。
三、文章编辑类
1、Black Studio TinyMCE Widget
wordpress 可以编辑文本的 网页小工具。
2、TinyMCE Advanced
增强版,wordpress 文章编辑软件,可以满足一般的使用需求了。
3、Crayon Syntax Highlighter
wordpress 代码编辑插件,可以方便的在文章中插入代码片段。风格比较多,覆盖比较全。
4、SyntaxHighlighter Evolved
wordpress 代码编辑插件,可以方便的在文章中插入代码片段。风格和前一种不同。
四、实用工具类
1、Collapsing Archives
一款将文章按月份自动收纳展开的插件。
2、Collapsing Categories
一款将文章按类别自动收纳展开的插件。
3、Media Library Assistant
一款对网站图片视频资源分类管理插件
4、Phoenix Media Rename
一款网站媒体资源重命名插件
5、Private content
可以在文章中,根据用户角色,判断是否能展示 文章部分隐藏内容。
6、User Access Manager
用户权限管理,可以设置哪些类别,文章,能被哪些用户访问。
7、Top 10
统计网站最流行的文章插件
8、WP Statistics
网站数据统计插件,统计网站各项数据
9、WP User Avatar
修改网站头像插件
10、wpDiscuz
网站论坛插件,在文章回复中添加验证码模块
11、Easy Table of Contents
有widget插件,可以自动生成文章目录,方便阅读
12、Q2W3 Fixed Widget
将侧边栏控件,自由设置固定还是滚动
五、网站维护类
1、Search & Replace
域名替换插件,可以替换数据库中所有域名信息。
2、UpdraftPlus – Backup/Restore
网站备份还原插件
六、界面美化类
1、weichuncai(WP伪春菜)
一款wordpress 桌面精灵插件。
2、Calendar Event
一款好看的日历插件
3、Responsive Lightbox
一款不错的网页图片浏览插件
wordpress 5.0 后,采用 simple code block 代码高亮插件
centos初装系统-安全性加固
转载自:https://www.linode.com/docs/security/securing-your-server/
In the Getting Started guide, you learned how to deploy a Linux distribution, boot your Linode and perform basic administrative tasks. Now it’s time to harden your Linode against unauthorized access.
Update Your System–FrequentlyPermalink
Keeping your software up to date is the single biggest security precaution you can take for any operating system. Software updates range from critical vulnerability patches to minor bug fixes, and many software vulnerabilities are actually patched by the time they become public.
Automatic Security UpdatesPermalink
There are arguments for and against automatic updates on servers. Fedora’s Wikihas a good breakdown of the pros and cons, but the risk of automatic updates will be minimal if you limit them to security updates. Not all package managers make that easy or possible, though.
The practicality of automatic updates is something you must judge for yourself because it comes down to what you do with your Linode. Bear in mind that automatic updates apply only to packages sourced from repositories, not self-compiled applications. You may find it worthwhile to have a test environment that replicates your production server. Updates can be applied there and reviewed for issues before being applied to the live environment.
- CentOS uses yum-cron for automatic updates.
- Debian and Ubuntu use unattended upgrades.
- Fedora uses dnf-automatic.
Add a Limited User AccountPermalink
Up to this point, you have accessed your Linode as the root user, which has unlimited privileges and can execute any command–even one that could accidentally disrupt your server. We recommend creating a limited user account and using that at all times. Administrative tasks will be done using sudo to temporarily elevate your limited user’s privileges so you can administer your server.
Note
Not all Linux distributions includesudoon the system by default, but all the images provided by Linode have sudo in their package repositories. If you get the outputsudo: command not found, install sudo before continuing.
To add a new user, first log in to your Linode via SSH.
CentOS / FedoraPermalink
- Create the user, replacing
example_userwith your desired username, and assign a password:useradd example_user && passwd example_user - Add the user to the
wheelgroup for sudo privileges:usermod -aG wheel example_userCaution
In CentOS 6 a wheel group is disabled by default for sudo access. You must to configure it manually. Type from root:/usr/sbin/visudo. Then find the line# %wheeland uncomment this line. To began typing in vi, pressa. To save and exit pressEscape, then type:w(press enter),:q(press enter)
UbuntuPermalink
- Create the user, replacing
example_userwith your desired username. You’ll then be asked to assign the user a password:adduser example_user - Add the user to the
sudogroup so you’ll have administrative privileges:adduser example_user sudo
DebianPermalink
- Debian does not include
sudoby default so it must be installed:apt install sudo - Create the user, replacing
example_userwith your desired username. You’ll then be asked to assign the user a password:adduser example_user - Add the user to the
sudogroup so you’ll have administrative privileges:adduser example_user sudo - After creating your limited user, disconnect from your Linode:
exit - Log back in as your new user. Replace
example_userwith your username, and the example IP address with your Linode’s IP address:ssh [email protected]
Now you can administer your Linode from your new user account instead of root. Nearly all superuser commands can be executed with sudo (example: sudo iptables -L -nv) and those commands will be logged to /var/log/auth.log.
Harden SSH AccessPermalink
By default, password authentication is used to connect to your Linode via SSH. A cryptographic key-pair is more secure because a private key takes the place of a password, which is generally much more difficult to brute-force. In this section we’ll create a key-pair and configure the Linode to not accept passwords for SSH logins.
Create an Authentication Key-pairPermalink
- This is done on your local computer, not your Linode, and will create a 4096-bit RSA key-pair. During creation, you will be given the option to encrypt the private key with a passphrase. This means that it cannot be used without entering the passphrase, unless you save it to your local desktop’s keychain manager. We suggest you use the key-pair with a passphrase, but you can leave this field blank if you don’t want to use one.Linux / OS X
Caution
If you’ve already created an RSA key-pair, this command will overwrite it, potentially locking you out of other systems. If you’ve already created a key-pair, skip this step. To check for existing keys, runls ~/.ssh/id_rsa*.ssh-keygen -b 4096Press Enter to use the default names
id_rsaandid_rsa.pubin/home/your_username/.sshbefore entering your passphrase.Windows
This can be done using PuTTY as outlined in our guide: Use Public Key Authentication with SSH.
- Upload the public key to your Linode. Replace
example_userwith the name of the user you plan to administer the server as, and203.0.113.10with your Linode’s IP address.LinuxFrom your local computer:ssh-copy-id [email protected]OS X
On your Linode (while signed in as your limited user):
mkdir -p ~/.ssh && sudo chmod -R 700 ~/.ssh/From your local computer:
scp ~/.ssh/id_rsa.pub [email protected]:~/.ssh/authorized_keysNote
ssh-copy-idis available in Homebrew if you prefer it over SCP. Install withbrew install ssh-copy-id.Windows
- Option 1: This can be done using WinSCP. In the login window, enter your Linode’s public IP address as the hostname, and your non-root username and password. Click Login to connect.Once WinSCP has connected, you’ll see two main sections. The section on the left shows files on your local computer and the section on the right shows files on your Linode. Using the file explorer on the left, navigate to the file where you’ve saved your public key, select the public key file, and click Upload in the toolbar above.You’ll be prompted to enter a path where you’d like to place the file on your Linode. Upload the file to
/home/example_user/.ssh/authorized_keys, replacingexample_userwith your username. - Option 2: Copy the public key directly from the PuTTY key generator into the terminal emulator connected to your Linode (as a non-root user):
mkdir ~/.ssh; nano ~/.ssh/authorized_keysThe above command will open a blank file called
authorized_keysin a text editor. Copy the public key into the text file, making sure it is copied as a single line exactly as it was generated by PuTTY. Press CTRL+X, then Y, then Enter to save the file.
Finally, you’ll want to set permissions for the public key directory and the key file itself:
sudo chmod 700 -R ~/.ssh && chmod 600 ~/.ssh/authorized_keysThese commands provide an extra layer of security by preventing other users from accessing the public key directory as well as the file itself. For more information on how this works, see our guide on how to modify file permissions.
- Option 1: This can be done using WinSCP. In the login window, enter your Linode’s public IP address as the hostname, and your non-root username and password. Click Login to connect.Once WinSCP has connected, you’ll see two main sections. The section on the left shows files on your local computer and the section on the right shows files on your Linode. Using the file explorer on the left, navigate to the file where you’ve saved your public key, select the public key file, and click Upload in the toolbar above.You’ll be prompted to enter a path where you’d like to place the file on your Linode. Upload the file to
- Now exit and log back into your Linode. If you specified a passphrase for your private key, you’ll need to enter it.
SSH Daemon OptionsPermalink
- Disallow root logins over SSH. This requires all SSH connections be by non-root users. Once a limited user account is connected, administrative privileges are accessible either by using
sudoor changing to a root shell usingsu -.- /etc/ssh/sshd_config
# Authentication: ... PermitRootLogin no - Disable SSH password authentication. This requires all users connecting via SSH to use key authentication. Depending on the Linux distribution, the line
PasswordAuthenticationmay need to be added, or uncommented by removing the leading#.- /etc/ssh/sshd_config
# Change to no to disable tunnelled clear text passwords PasswordAuthentication noNote
You may want to leave password authentication enabled if you connect to your Linode from many different computers. This will allow you to authenticate with a password instead of generating and uploading a key-pair for every device. - Listen on only one internet protocol. The SSH daemon listens for incoming connections over both IPv4 and IPv6 by default. Unless you need to SSH into your Linode using both protocols, disable whichever you do not need. This does not disable the protocol system-wide, it is only for the SSH daemon.Use the option:
AddressFamily inetto listen only on IPv4.AddressFamily inet6to listen only on IPv6.
The
AddressFamilyoption is usually not in thesshd_configfile by default. Add it to the end of the file:echo 'AddressFamily inet' | sudo tee -a /etc/ssh/sshd_config - Restart the SSH service to load the new configuration.If you’re using a Linux distribution which uses systemd (CentOS 7, Debian 8, Fedora, Ubuntu 15.10+)
sudo systemctl restart sshdIf your init system is SystemV or Upstart (CentOS 6, Debian 7, Ubuntu 14.04):
sudo service ssh restart
Use Fail2Ban for SSH Login ProtectionPermalink
Fail2Ban is an application that bans IP addresses from logging into your server after too many failed login attempts. Since legitimate logins usually take no more than three tries to succeed (and with SSH keys, no more than one), a server being spammed with unsuccessful logins indicates attempted malicious access.
Fail2Ban can monitor a variety of protocols including SSH, HTTP, and SMTP. By default, Fail2Ban monitors SSH only, and is a helpful security deterrent for any server since the SSH daemon is usually configured to run constantly and listen for connections from any remote IP address.
For complete instructions on installing and configuring Fail2Ban, see our guide: Securing Your Server with Fail2ban.
Remove Unused Network-Facing ServicesPermalink
Most Linux distributions install with running network services which listen for incoming connections from the internet, the loopback interface, or a combination of both. Network-facing services which are not needed should be removed from the system to reduce the attack surface of both running processes and installed packages.
Determine Running ServicesPermalink
To see your Linode’s running network services:
sudo ss -atpu
The following is an example of the output given by ss, and shows that the SSH daemon (sshd) is listening and connected. Note that because distributions run different services by default, your output will differ.
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port tcp LISTEN 0 128 *:ssh *:* users:(("sshd",pid=3675,fd=3)) tcp ESTAB 0 208 203.0.113.1:ssh 198.51.100.2:54820 users:(("sshd",pid=3698,fd=3)) tcp LISTEN 0 128 :::ssh :::* users:(("sshd",pid=3675,fd=4))
TCPPermalink
See the Peer Address:Port column of the ss readout. The process sshd is listening on *:*, which translates into any incoming IPv4 address to any port, and over any network interface. The next line shows an established SSH connection from IP address 198.51.100.2 via ephemeral port 54820. The last line, :::*denotes the sshd process listening for any incoming SSH connections over IPv6 to any port, and again over any network interface.
UDPPermalink
UDP sockets are stateless, meaning they are either open or closed and every process’s connection is independent of those which occurred before and after. This is in contrast to TCP connection states such as LISTEN, ESTABLISHED and CLOSE_WAIT. The ss output above shows no UDP connections.
Determine Which Services to RemovePermalink
A basic TCP and UDP nmap scan of your Linode without a firewall enabled would show SSH and possibly other services listening for incoming connections. By configuring a firewall you can filter those ports to your requirements. Ideally, the unused services should be disabled.
You will likely be administering your server primarily through an SSH connection, so that service needs to stay. As mentioned above, RSA keys and Fail2Ban can help protect SSH. System services like chronyd, systemd-resolved, and dnsmasqare usually listening on localhost and only occasionally contacting the outside world. Services like this are part of your operating system and will cause problems if removed and not properly substituted.
However, some services are unnecessary and should be removed unless you have a specific need for them. Some examples could be Exim, Apache and RPC.
Uninstall the Listening ServicesPermalink
How to remove the offending packages will differ depending on your distribution’s package manager.
Arch
sudo pacman -Rs package_name
CentOS
sudo yum remove package_name
Debian / Ubuntu
sudo apt purge package_name
Fedora
sudo dnf remove package_name
Run ss -atup again to verify that the unwanted services are no longer running.
Configure a FirewallPermalink
Using a firewall to block unwanted inbound traffic to your Linode provides a highly effective security layer. By being very specific about the traffic you allow in, you can prevent intrusions and network mapping. A best practice is to allow only the traffic you need, and deny everything else. See our documentation on some of the most common firewall applications:
- Iptables is the controller for netfilter, the Linux kernel’s packet filtering framework. Iptables is included in most Linux distributions by default.
- FirewallD is the iptables controller available for the CentOS / Fedora family of distributions.
- UFW provides an iptables frontend for Debian and Ubuntu.
Next StepsPermalink
These are the most basic steps to harden any Linux server, but further security layers will depend on its intended use. Additional techniques can include application configurations, using intrusion detection or installing a form of access control.
Now you can begin setting up your Linode for any purpose you choose. We have a library of documentation to assist you with a variety of topics ranging from migration from shared hosting to enabling two-factor authentication to hosting a website.
See Also
centos初装系统-修改timezone
It may be better to use the same timezone which a majority of your users are located in, or that you live in to make log file timestamps more sensible.
Debian / Ubuntu
[bash]dpkg-reconfigure tzdata[/bash]
Arch Linux and CentOS 7
View the list of available time zones.
[bash]timedatectl list-timezones[/bash]
Use the Up, Down, Page Up and Page Down keys to navigate. Find the time zone which you want. Remember it, write it down or copy it as a mouse selection. Then press q to exit the list.
To set the time zone:
[bash]timedatectl set-timezone ‘America/New_York'[/bash]
Gentoo
View the list of available time zones.
[bash]ls /usr/share/zoneinfo[/bash]
Write the selected time zone to the /etc/timezone file.
Example (for Eastern Standard Time):
[bash]echo "EST" > /etc/timezone[/bash]
Configure the sys-libs/timezone-data package, which will set /etc/localtimeappropriately.
[bash]emerge –config sys-libs/timezone-data[/bash]
Check the Time
View the current date and time according to your server.
[bash]date[/bash]
The output should look similar to: Thu Feb 16 12:17:52 EST 2012.
转载自:https://www.linode.com/docs/getting-started/
centos初装系统-修改hostname
你系统的主机名应该是唯一的。 有些人用行星,哲学家或动物命名他们的服务器。 请注意,除了为系统本身提供名称之外,主机名与托管在其上的网站或电子邮件服务没有任何关系。 您的主机名不应该是“www”或任何太普通的名字。如果您想为您的系统分配一个完全合格的域名,请参阅我们的关于使用您系统的主机文件的指南。如果您想为您的系统分配一个完全合格的域名,请参阅我们的关于使用您系统的主机文件的指南。
Arch / CentOS 7 / Debian 8 / Fedora / Ubuntu 16.04 and above
Replace example_hostname with one of your choice.
[bash]hostnamectl set-hostname example_hostname[/bash]
Debian 7 / Slackware / Ubuntu 14.04
Replace example_hostname with one of your choice.
[bash]
echo "example_hostname" > /etc/hostname
hostname -F /etc/hostname
[/bash]
Note
Debian and Ubuntu include a line in their hosts file for a loopback domain by default (127.0.1.1), but even though they’re closely related, the commands above to set a hostname don’t change the loopback domain.
The result is the message when using sudo commands: sudo: unable to resolve host . To fix this, add your hostname to the hosts file as shown in the last example here.
CentOS 6
Replace hostname with one of your choice.
[bash]
echo "HOSTNAME=example_hostname" >> /etc/sysconfig/network
hostname "hostname"
[/bash]
Gentoo
Enter the following commands to set the hostname, replacing example_hostnamewith the hostname of your choice:
[bash]
echo "HOSTNAME=\"example_hostname\"" > /etc/conf.d/hostname
/etc/init.d/hostname restart
[/bash]
转载自:https://www.linode.com/docs/getting-started/
mysql设置-修改登录密码
MySQL修改root密码的多种方法(推荐)
方法1: 用SET PASSWORD命令
MySQL -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
方法2:用mysqladmin
mysqladmin -u root password "newpass"
如果root已经设置过密码,采用如下方法
mysqladmin -u root password oldpass "newpass"
方法3: 用UPDATE直接编辑user表
mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
mysql> FLUSH PRIVILEGES;
在丢失root密码的时候,可以这样
mysqld_safe --skip-grant-tables&
mysql -u root mysql
mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';
mysql> FLUSH PRIVILEGES;
参考:https://www.jb51.net/article/109259.htm
