美文网首页
Linux运维踩坑记录

Linux运维踩坑记录

作者: syushin | 来源:发表于2020-03-19 11:27 被阅读0次

1. 无法删除某某目录下的.user.ini

在删除lnmp目录时,出现提示:

rm: cannot remove ‘/www/wwwroot/xxxx/.user.ini’: Operation not permitted

原因:文件权限被锁定,需要先解除锁定,再执行rm -rf
解决命令:

$ chattr -i /www/wwwroot/xxxx/.user.ini
$ rm -rf /www/wwwroot/xxxx/

2. 卸载宝塔软件时,删除/www目录下的swap

宝塔软件卸载后,想删除/www目录,如果直接删除是删除不了swap的

$ pwd
/www 
$ ls
backup  server  swap  wwwlogs  wwwroot

这个是交换分区,也就是虚拟内存,当服务器的内存不够用时系统会拿这个swap空间临时顶一下当内存用。如果要删除的话执行命令:

$ swapoff /www/swap
$ rm -rf swap

3. Gitlab手贱关闭了Sign-in

起因是想要关闭Gitlab的注册功能(Sign-up),结果眼瞎了关闭了Sign-in,也就是关闭了Gitlab的登陆功能。这个关闭了,访问gitlab时就会出现:



一定要擦亮眼睛看清楚哪一个。


关闭注册
这是关闭登陆
关闭登陆

然后就是手贱点了关闭登陆的解决办法,如果是旧版本的gitlab,进入gitlab所在的服务器,执行下面命令即可。

$ gitlab-psql gitlabhq_production
gitlabhq_production=# update application_settings SET signin_enabled=true;
gitlabhq_production=# \q
$ gitlab-ctl restart

如果是较新版本的gitlab,在执行时会遇到错误:

$ gitlab-psql gitlabhq_production
could not change directory to "/root": Permission denied
psql ()
Type "help" for help.
 
gitlabhq_production=#  update application_settings SET signin_enabled=true;
ERROR: column "signin_enabled" of relation "application_settings" does not exist
LINE 1: update application_settings SET signin_enabled=true;

因为新版本虽然还有Sign-up关闭注册的功能,但是数据库已经没有了Signin_enabled字段了。新版解决方法:

$ gitlab-psql gitlabhq_production
could not change directory to "/root": Permission denied
psql ()
Type "help" for help.
 
gitlabhq_production=# update application_settings set password_authentication_enabled = true;
UPDATE
gitlabhq_production=# \q
$ gitlab-ctl restart

重新访问,就可以看到登陆入口了。


相关文章

网友评论

      本文标题:Linux运维踩坑记录

      本文链接:https://www.haomeiwen.com/subject/ppvgkhtx.html