linux-base


title: linux base
tags: linux
categories: linux
date: 2021-04-19 23:14:50

linux base

centos6 定时重启
vi /etc/crontab
按照提示添加 
00 06 * * * root reboot
载入内存
crontab /etc/crontab
启动服务并设置开机自启动
systemctl enable crond.service
systemctl restart crond.service
查看定时配置
crontab -l
查看系统启动记录
last reboot
who -b
ubuntu 设置root ssh 登录
重置 root 的密码
sudo passwd root
su
vi /etc/ssh/sshd_config 
将 PermitRootLogin 参数修改为 yes。
将 PasswordAuthentication 参数修改为 yes。
若 sshd_config 配置文件中无此配置项,则添加 PasswordAuthentication yes 项即可。
service ssh restart
远程复制
环境变量
  • 问题描述:
    安装postgresql开发环境的时候,配置环境变量,写入export PGHOME到 /etc/profile中,由于需要重启机器才能使修改全面生效;
    在不重启电脑的情况下,每次打开终端都得source一下才能生效。如何才能立刻生效呢?

解决方法:由于每次启动终端的时候,都会执行 /etc/bashrc ,所以可以把source /etc/profile 命令
写入到 /etc/bashrc 文件中,实现环境变量立刻全面生效的效果。

忘记root密码

按住shift键reboot进入grub,选择advanced option,进入recovery mode, 选择root drop to root shell prompt

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值