最近入手了华为的电信hn8145x6 一台,已经通过论坛的方法升级到r21.s05,升级后想清除之前的使用日志,用cat指令发现自己的shell权限不够,是srv_clid的一个普通用户权限。登录telnet用的root,但操作时一直都给的不是root权限,有没有大佬想个办法解决下。, `5 C* M; g2 |: X6 n: o y
我看了下/etc/passwd里面root给的shell路径是/sbin/nologin/,把这一段改成/sbin就好了,但现在/etc权限是只读,无法修改里面文件的内容,用mount也用不上(不是真root权限用户),现在就是一个死循环,修改/etc里面文件就可以获得最高权限,但/etc是只读,需要最高权限修改文件权限才能进行后续操作,有没有linux或者光猫大佬出个主意来获得shell里的root权限。
张小牛 发表于 2022-10-29 01:40/ Z- I! Q4 h5 G% Y: ~
教大家一招: , d7 o- l; D6 M. @root@SAF:~# cat /etc/rc.local; n) f. D0 F' G( A
# Put your custom commands here that should be executed o ...
! ?" v1 r0 V3 Q' T% S
牛哥牛批,我也是这么搞的,使用busybox.setuid su -切换root
张小牛 发表于 2022-10-29 01:40 - l$ q1 C) a o0 N教大家一招: # r7 e1 |5 ]: N+ Proot@SAF:~# cat /etc/rc.local % K# V* C3 u4 O3 ]+ r8 n# Put your custom commands here that should be executed o ...
教大家一招: $ c+ R; k+ l2 e+ K0 nroot@SAF:~# cat /etc/rc.local4 b& C; _" A {% o! P
# Put your custom commands here that should be executed once8 A3 I. t4 |& }. B0 o
# the system init finished. By default this file does nothing. ' y6 z. O) s% K# k 9 X5 a7 N5 D. M x7 Esed -i '/^root/{s%/sbin/nologin%/bin/sh%;s%^root:[^:]*:%root::%}' /e8cvar/passwd 2 z9 o% W2 u f) m( G2 T4 T