惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
Attack and Defense Labs
Attack and Defense Labs
V2EX - 技术
V2EX - 技术
O
OpenAI News
S
Secure Thoughts
H
Heimdal Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Schneier on Security
Schneier on Security
H
Hacker News: Front Page
S
Security Affairs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
The Register - Security
The Register - Security
GbyAI
GbyAI
Cloudbric
Cloudbric
MongoDB | Blog
MongoDB | Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
Forbes - Security
Forbes - Security
Y
Y Combinator Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Scott Helme
Scott Helme
Hacker News - Newest:
Hacker News - Newest: "LLM"
The Cloudflare Blog
Recorded Future
Recorded Future
人人都是产品经理
人人都是产品经理
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
Webroot Blog
Webroot Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog
T
Tor Project blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
Hacker News: Ask HN
Hacker News: Ask HN
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
I
Intezer
V
V2EX
T
Tailwind CSS Blog
SecWiki News
SecWiki News
NISL@THU
NISL@THU
C
Check Point Blog

git入门系列 on 打工人日志

CI/CD 可观察性-基于grafana sonarqube docker安装和配置 SSH 通过 443 端口连接 GitHub ansible 命令 Git 规则 git版本控制 CICD 概念 git使用方法 Jenkins 安装与使用 ansible 安装和部署 gitlab与github同步项目 git技巧 gitlab CI/CD 的使用 Markdown教程
Gitlab批量导出用户
2022-01-14 · via git入门系列 on 打工人日志

Gitlab 批量导出用户

登陆 Gitlab 服务器进行数据库登陆、数据查询及信息导出操作。

操作步骤

  1. 根据配置文件,定位数据库相关信息
1cat /var/opt/gitlab/gitlab-rails/etc/database.yml

exportuser1

  1. 查看 Gitlab 对应的系统用户
1cat /etc/passwd | grep gitlab

exportuser2

  1. 切换用户 gitlab-psql
  1. 登陆数据库(-h 指定 host,-d 指定数据库) 使用第 1 步获取的信息
1psql -h /var/opt/gitlab/postgresql -d gitlabhq_production

(1) 查看帮助信息

1gitlabhq_production=# \h

(2) 查看数据库

1gitlabhq_production=# \l

(3) 查看库中的表(执行命令后,按回车键显示更多表信息)

1gitlabhq_production=# \dt

(4) 通过筛查,可在库中找到 users 表,相关用户信息都记录在表中!

1gitlabhq_production=# \d users

(5) 查看表信息

1gitlabhq_production=# SELECT * FROM users;

(6) 查看 users 表中的 name 字段

1gitlabhq_production=# SELECT name FROM users;

(7)登出数据库

1gitlabhq_production=# \q
  1. 根据需要提取的信息,确定表 users 中的字段,进行导出操作
1echo 'select name,username,email,state from users;' |psql -h /var/opt/gitlab/postgresql -d gitlabhq_production > userinfo.txt

存储在/var/opt/gitlab/postgresql/userinfo.txt