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

推荐订阅源

W
WeLiveSecurity
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
The Register - Security
The Register - Security
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
S
SegmentFault 最新的问题
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
AI
AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
U
Unit 42
腾讯CDC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
H
Help Net Security
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
博客园 - 聂微东
S
Securelist
大猫的无限游戏
大猫的无限游戏
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog

gitlab 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 gitlab 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