Ubuntu linux 所遇问题随笔

(1. 当ping www.baidu.com 等外网无法ping通时,可通过指令进行排查如下:

$: sudo vim /etc/resolv.conf

查看resolv.conf文件中是否配置正确,正确的配置一般如下:

nameserver 10.22.10.1(你的IP)
search ROLLINGWIRELESS.LOCAL (你的域名)

2. 当安装openladp执行“./configure --prefix=/usr/local/openldap” 报错

“checking Berkeley DB version for BDB/HDB backends... no
configure: error: BDB/HDB: BerkeleyDB version incompatible” 时,解决方法一般有:

(1)将相关文件拷贝到相应位置:

      把/usr/local/BerkeleyDB.5.2.23/include中的所有文件拷贝到/usr/include
      把/usr/local/BerkeleyDB.5.2.23/lib中的所有文件拷贝到/usr/lib 

        在root用户下,一般执行指令如下:

        $: cd  /usr/local/BerkeleyDB.5.2.23/include

        $: sudo cp -r ./   /usr/include

        $: cd  /usr/local/BerkeleyDB.5.2.23/lib

        $: sudo cp -r ./   /usr/lib

(2) BerkeleyDB版本问题,本人之前安装的为6.2.23版本,报错时,查看log发现本机的其他配置仅仅支持6.0.20以下的版本,在更换5.2.23版本后,问题得以解决。下面是5.2.23版本的下载网址(需先注册才能下载):

Oracle Berkeley DB — 早期版本 | Oracle 中国

http://download.oracle.com/otn/berkeley-db/db-5.3.28.tar.gz

3. 血泪教训-------为了修改etc目录下的某个文件夹权限,直接将/etc的权限全部打开,后来进行了一些补救,又进行了一些权限修改操作,导致/etc目录下的文件权限严重混乱,具体表现如下:

(1)remote side unexpectedly close (ssh远程连接不上,目测ssh文件权限出了问题);

(2)运行sudo命令时报错:“ sudo: /etc/sudoers is world writable 

                                               sudo: no valid sudoers sources found, quitting

                                               sudo: unable to initialize policy plugin ”

(sudoers文件权限出了问题,变成了可读可写)

(3)/etc/profile: Permission denied (/etc/profile权限不够,也是sudo权限出了问题)

(4)最严重的,登录ubuntu,无法进行用户登录,因登录时需读取/etc/profile中的用户配置以及bash.rc等文件,其权限不够,卡死在登录界面。

网上搜了一些解决方法,都很不错,但是针对这种情况仅局部适用,多方总结之后,得出了一个适合自己的笨方法:

1. 本人自建的超级用户不能用了,系统自带的root也不清楚密码,首先就是按照root密码忘记的情况重置root密码,过程如下:

(1)重启 Ubuntu 系统,按 Esc 进入GRUB 菜单界面

(2) 选择recovery mode. (第二个)按回车键进入.Recover Menu菜单,如下图

(3) 选择root , 按回车, 在下方就会出现root终端:

运行修改root的指令:

$: passwd root

系统会提示输入新的密码: xxx

系统提示再次输入新的密码: xxx

最后显示密码重置成功,后面就可以用root账户登录了。

2. 用刚刚的root 账户登录进去,修改/etc中的文件的权限为默认值,修改参照可另开一个终端ssh远程登录其他服务器,看一下它的/etc中的文件的权限的设置,对照进行修改,具体过程如下:

(1)在服务器端,重启开机时,按“ Ctr + Alt + F1 “ 进入tty终端,以root账户登录;

(2)依次修改/etc中的文件的权限,其实仅需要将关键的几个文件如/etc/sudoers、/etc/profile、/etc/ssh、/etc/bash.rc等文件修改即可,但因本人将其他文件的权限搞得一塌糊涂,因此就比较笨拙的将/etc中所有的文件权限都改了一遍,具体如下:

部分文件参考权限设置表:

..........................

..........................

rwxr-xr-x 146 root root    12288 8月  30 09:53 ./
drwxr-xr-x  28 root root     4096 8月  26 14:46 ../
-rw-r--r--   1 root root     3028 8月   7  2020 adduser.conf
-rw-r--r--   1 root root     2188 9月   1  2015 bash.bashrc
-rw-r--r--   1 root root       45 8月  13  2015 bash_completion
drwxr-xr-x   2 root root     4096 8月  25 14:09 bash_completion.d/
drwxr-xr-x   3 root root     4096 8月   7  2020 ca-certificates/
-rw-r--r--   1 root root     6533 8月  10 06:49 ca-certificates.conf
-rw-r--r--   1 root root     5678 8月   7  2020 ca-certificates.conf.dpkg-old
drwxr-xr-x   4 root root     4096 8月  27 10:47 dpkg/
-rw-r--r--   1 root root      106 8月  25 14:09 environment
-rw-rw-r--   1 root root      953 8月   9 10:58 fstab
-rw-r--r--   1 root root     1111 8月  30 09:50 group
-rw-------   1 root root     1098 8月  25 14:30 group-
drwxr-xr-x   2 root root     4096 8月  25 14:09 grub.d/
drwxr-xr-x   2 root root     4096 4月   1  2017 guest-session/
-rw-r--r--   1 root root       92 10月 23  2015 host.conf
-rw-r--r--   1 root root       16 8月  23 10:45 hostname
-rw-r--r--   1 root root      267 8月  27 10:25 hosts
-rw-r--r--   1 root root      411 8月   7  2020 hosts.allow
-rw-r--r--   1 root root      711 8月   7  2020 hosts.deny
drwxr-xr-x   3 root root     4096 8月   9 11:13 .java/
drwxr-xr-x   4 root root     4096 8月   9 11:13 java-9-openjdk/
drwxr-xr-x   5 root root     4096 8月   7  2020 kernel/
drwxr-xr-x   3 root root     4096 8月  27 11:15 lightdm/
drwxr-xr-x   4 root root     4096 8月   9 11:10 lighttpd/
-rw-r--r--   1 root root    10551 3月  29  2016 login.defs
-rw-r--r--   1 root root      195 8月   7  2020 modules
drwxr-xr-x   7 root root     4096 8月  27 09:42 network/
-rw-r--r--   1 root root       91 10月 23  2015 networks
-rw-r--r--   1 root root     2669 8月  30 09:50 passwd
-rw-------   1 root root     2625 8月  30 09:50 passwd-
-rw-r--r--   1 xxx   xxx     1457 8月  10 10:33 profile
drwxr-xr-x   2 root root     4096 8月  10 06:52 profile.d/
drwxr-xr-x   2 root root     4096 8月   7  2020 python/
drwxr-xr-x   2 root root     4096 8月   9 11:10 python2.7/
drwxr-xr-x   2 root root     4096 8月   7  2020 python3/
drwxr-xr-x   2 root root     4096 8月  10 06:53 python3.5/
drwxr-xr-x   5 root root     4096 8月   7  2020 resolvconf/
drwxr-xr-x   3 root root     4096 8月  10 17:36 samba/
-rw-r--r--   1 root root     3663 6月   9  2015 screenrc
-rw-r--r--   1 root root      111 8月   9 11:14 shells
drwxr-xr-x   2 root root     4096 8月   9 11:07 ssh/
drwxr-xr-x   4 root root     4096 8月  25 14:09 ssl/
-r--r-----   1 root root      755 2月   1  2020 sudoers
drwxr-xr-x   2 root root     4096 8月  10 06:50 sudoers.d/
-rw-r--r--   1 root root      477 7月  20  2015 zsh_command_not_found

.........................

.........................

修改指令:

$: cd /etc

$: chmod  755   ssh/

$: chmod  440   sudoers/

$: chmod  644  profile

$: chmod  644    bash.bashrc

........................................

.......................................

...........................................

4. 本人是在ldap端节点中已有本人的账号密码信息情况下,ldapsearch指令验证linux server和 ldap server 的连接,并试图实现最终通过域账号登录linux server;

当前已实现的相关过程如下:(先用个人账号登录相关linux server)

(1)$: ldapsearch -H ldap://10.22.10.1:389 -D "bindusername" -w "bindpassword" -b "ou=xxx,dc=xxx,dc=com" -s sub "(sAMAccountName=username (e,kuke.liu))"

----"bindusername"是指你的已有的ldap账户名,一般是“ 名+空格+姓 ”,首字母大写;

----"bindpassword"是指你的已有的ldap账户密码;

----username 一般是sAM账户名,一般为“ 名+点(.)+姓 ”,全部小写;

(2)执行上条指令,在密码和账户正确时,若linux服务器端未安装ldap一般会提示:

请以“ sudo apt install ldap-utils ”指令安装ldap

$: sudo apt install ldap-utils

安装成功后,重新执行(1)指令,即可获取个人的ldap账户信息,最终以以下内容结尾:

以上证明在linux端通过账户及密码能与ldap server建立连接,后续需进一步配置,使得能通过域名账号访问linux server,具体实现(更新中.......) 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值