linux系统

Linux 之 /etc/profile、~/.bash_profile 等几个文件的执行过程

旧时模样 提交于 2020-03-10 11:03:46
在登录Linux时要执行文件的过程如下: 在刚登录Linux时,首先启动 /etc/profile 文件,然后再启动用户目录下的 ~/.bash_profile、 ~/.bash_login或 ~/.profile文件中的其中一个, 执行的顺序为:~/.bash_profile、 ~/.bash_login、 ~/.profile。 如果 ~/.bash_profile文件存在的话,一般还会执行 ~/.bashrc文件。 因为在 ~/.bash_profile文件中一般会有下面的代码: if [ -f ~/.bashrc ] ; then . ./bashrc fi ~/.bashrc中,一般还会有以下代码: if [ -f /etc/bashrc ] ; then . /etc/bashrc fi 所以,~/.bashrc会调用 /etc/bashrc文件。最后,在退出shell时,还会执行 ~/.bash_logout文件。 执行顺序为: /etc/profile -> (~/.bash_profile | ~/.bash_login | ~/.profile) -> ~/.bashrc -> /etc/bashrc -> ~/.bash_logout 关于各个文件的作用域,在网上找到了以下说明: (1) /etc/profile: 此文件为系统的每个用户设置环境信息

Linux安全管理(1)

心已入冬 提交于 2020-03-10 10:23:50
1.禁止ROOT远程登录 修改/etc/ssh/sshd_config文件,配置PermitRootLogin no。 重启服务,/etc/init.d/sshd restart。 2.检查是否关闭不必要的服务和端口 chkconfig --level 345 nfslock off 3.检查别名文件/etc/aliase配置 编辑别名文件vi /etc/aliases,删除或注释掉下面的行 4.检查系统core dump设置 echo "* hard core 0" >>/etc/security/limits.conf echo "* soft core 0" >>/etc/security/limits.conf 5.检查历史命令设置 #games: root #ingres: root #system: root #toor: root #uucp: root #manager: root #dumper: root #operator: root #decode: root #root: marc 更新后运行/usr/bin/newaliases,使改变生效 6.检查历史命令设置 echo "HISTFILESIZE=5" >>/etc/profile 7.检查拥有suid和sgid权限的文件 for file in find /usr/bin/chage /usr

linux系统中配置网络桥接

余生长醉 提交于 2020-03-10 10:15:03
设置网络ip 我在网上找到的配置网络桥接,大多是在vmware中。所以我就自行整理一下在linux系统中如何设置桥接模式 网桥设定 1.cd /etc/sysconfig/network-scripts 2.ls 3.rm -fr ifcfg-br0 ifcfg-westos 大家如果是在真机中做实验的话,可以通过 mv /etc/sysconfig/network-scripts/ifcfg-br0 /mnt 和 mv /etc/sysconfig/network-scripts/ifcfg-westos /mnt 将文件移动到/mnt下 此处的westos是我的电脑里面的,你们可以看看自己电脑里面的是什么。也可能是ifcfg-eth0或ifcfg-enp1s0之类的 4.vim ifcfg-br0 5.vim ifcfg-westos 6.重启网络 rhel7: systemctl restart network rhel8: systemctl restart NetworkManager 来源: CSDN 作者: ly_qiu 链接: https://blog.csdn.net/ly_qiu/article/details/104755515

linux防火墙添加端口

时光总嘲笑我的痴心妄想 提交于 2020-03-10 09:34:23
iptables版 #vi /etc/sysconfig/iptables 添加以下语句 -A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 3690 -j ACCEPT 重启iptables #service iptables restart firewalld版 一、防火墙相关命令   1、查看防火墙状态 : systemctl status firewalld.service     注:active是绿的running表示防火墙开启   2、关闭防火墙 :systemctl stop firewalld.service   3、开机禁用防火墙自启命令 :systemctl disable firewalld.service   4、启动防火墙 :systemctl start firewalld.service   5、防火墙随系统开启启动 : systemctl enable firewalld.service   6、重启防火墙 : firewall-cmd --reload 二、端口开放相关命令   1、查询已经开放的端口 :firewall-cmd --list-port   2、查询某个端口是否开放 :firewall-cmd --query-port=80/tcp   3、开启端口

Linux学习之路:day 6

北城余情 提交于 2020-03-10 09:32:05
一、时间日期类指令 1.date:显示当前日期。 语法:date “+%Y-%m-%d %H:%M:%S”:显示年月日时分秒;    date -s 字符串时间:设置系统当前时间; 2.cal:查看日历。 语法:cal 【选项】 (不加选项,显示本月日历);    cal 2020:显示2020年日历; 二、搜索查找类指令 1.find:从指定目录向下递归地遍历其各个子目录,将满足条件的文件或目录显示在终端。 语法:find 【搜索范围】 【选项】 2.locate:利用事先建立的locate数据库(包含所有文件名称及路径)实现快速定位给定的文件。无需遍历整个文件系统,查询速度快,但需要定期更新locate时刻。 3.grep:过滤查找。 语法:grep 【选项】查找内容 源文件 “|”:管道符,将前一个命令的输出结果传递给后一个命令处理。 三、压缩和解压类指令 1.gzip(压缩)/gunzip(解压) 2.zip(压缩)/unzip(解压) 语法:zip 【选项】xxx.zip 要压缩的内容       -r:递归压缩,即压缩目录。    unzip【选项】xxx.zip       -d <目录>:指定解压后文件的存放目录。 3.tar:打包指令,打包后为后缀是 .tar.gz 的文件。 语法:tar 【选项】xxx.tar.gz 要打包的内容 来源: CSDN 作者:

[转帖]Linux Chromium Arm Recipes

痴心易碎 提交于 2020-03-10 07:48:32
Linux Chromium Arm Recipes https://chromium.googlesource.com/chromium/src/+/master/docs/linux/chromium_arm.md Contents Recipe1: Building for an ARM CrOS device Recipe2: Explicit Cross compiling Installing the toolchain Installing the sysroot Building Testing Automated Build and Testing Testing with QEMU Notes Recipe1: Building for an ARM CrOS device https://sites.google.com/a/chromium.org/dev/developers/how-tos/-quickly-building-for-cros-arm-x64 Recipe2: Explicit Cross compiling Due to the lack of ARM hardware with the grunt to build Chromium native, cross compiling is currently the

linux centos7 lnmp 安装redis及php开启redis扩展 自测

早过忘川 提交于 2020-03-10 07:15:44
php7安装Redis扩展 同样的,Redis其实也已经有了 PHP 7 版本,我们从 github 上获取项目克隆,然后手动切换到 php7 分支即可: git clone -b php7_ipv6 https://github.com/phpredis/phpredis.git cd /usr/local/phpredis/ /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make && make install 启动扩展 光安装了还不够,我们还需要编辑PHP的配置文件来使扩展被加载才行, vi / etc / php / 7.0 / fpm / php .ini ,在配置文件中添加如下语句: extension=memcached.so extension=redis.so 最后使用命令来重启 PHP 服务: service php7 . 0 - fpm restart 4.修改你的php.ini文件,添加redis扩展 extension=redis.so 重启php-fpm 然后 php -m 命令可以看到redis扩展已经开启,当然了我安装的也没那么顺利,不过关机之后再次开机,没问题的话就都好了,所以强烈建议,当所有东西都设置完毕之后,关机

linux中/etc/security/limits.conf配置文件说明

旧巷老猫 提交于 2020-03-10 06:41:58
linux资源限制配置文件是/etc/security/limits.conf;限制用户进程的数量对于linux系统的稳定性非常重要。 limits.conf文件限制着用户可以使用的最大文件数,最大线程,最大内存等资源使用量。 limits.conf的格式如下: username|@groupname type resource limit username|@groupname:设置需要被限制的用户名,组名前面加@和用户名区别。也可以用通配符*来做所有用户的限制。 type: soft,hard 和 - soft 指的是当前系统生效的设置值。 hard 表明系统中所能设定的最大值。soft 的限制不能比har 限制高。 - 表明同时设置了 soft 和 hard 的值。 resource: core - 限制内核文件的大小 date - 最大数据大小 fsize - 最大文件大小 memlock - 最大锁定内存地址空间 nofile - 打开文件的最大数目 rss - 最大持久设置大小 stack - 最大栈大小 cpu - 以分钟为单位的最多 CPU 时间 noproc - 进程的最大数目 as - 地址空间限制 maxlogins - 此用户允许登录的最大数目 要使 limits.conf 文件配置生效,必须要确保 pam_limits.so 文件被加入到启动文件中。查看

Linux系统的一些命令记录

故事扮演 提交于 2020-03-10 06:41:40
目录创建命令: 例如:mkdir /tmp 创建一个 名为tmp的目录 mkdir -p:递归创建,例如:mkdir -p /tmp/Q 目录切换命令: cd /tmp 切换到tmp目录下,值得注意的是,若直接输入cd,则直接进入根目录,且cd命令必须遵循绝对路径规则。 pwd 为显示当前所在目录。 删除目录文件: 注意为删除空目录,例如rmdir /tmp为删除tmp目录,若非空则失败 复制命令: cp 复制文件例如:cp /tmp/issue /root 复制到root目录下,在root后面输入/xiao,则可以将文件改名为xiao,若要复制文件夹:cp -r /tmp/cangjing /root ,复制到root目录下。cp -p保留文件属性 文件剪切则为mv,例如:mv /tmp/cangjing/boduo/longze /root则为将文件longze剪切到root下,亦可以改名,和cp类似 在当前目录下改名为:mv cangjing canglaoshi注意必须为当前目录下的文件 删除文件: rm -rf为强制删除文件或目录 rm -r删除目录 rm -f强制执行 r, -rf *为删除所有文件 注意在linux系统中不存在回收站,rm -rf为危险命令。 文件创建: touch /tmp

记一次 linux ssh root用户设置远程登陆无效解决方法

前提是你 提交于 2020-03-10 05:57:44
在阿里云上买了台linux服务器,centos操作系统,配置好账号密码后, 其他账号都没问题,root账号死活无法远程ssh登陆, 百度出来全是PermitRootLogin yes配置好就可以了,但是我配置了还是不行。 搞了两个多小时,没折腾好。 实在看不到希望,这才想到了ssh的登陆日志, 在/var/log目录下secure文件。 tail -f -n 200 /var/log/secure 看了日志才发现 Mar 8 16:08:41 iZuf6dtic2d71q1enfn0efZ sshd[29375]: User admin from xxx.xx.xx.xx not allowed because not listed in AllowUsers 这才想起sshd_config 文件中还有一项配置AllowUsers 需要把root也加进入,修改配置重启sshd服务,问题解决了! 回想起来,还是解决问题的思路不对,如果一开始想到查看日志,估计就5分钟就解决了!因为有百度依赖症,什么问题都想通过百度来解决。 来源: CSDN 作者: openzhang 链接: https://blog.csdn.net/u010212271/article/details/104750966