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

推荐订阅源

N
Netflix TechBlog - Medium
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
Hugging Face - Blog
Hugging Face - Blog
L
LINUX DO - 热门话题
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
D
Docker
C
Cyber Attacks, Cyber Crime and Cyber Security
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
T
Tenable Blog
P
Privacy International News Feed
Google DeepMind News
Google DeepMind News
小众软件
小众软件
Cisco Talos Blog
Cisco Talos Blog
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
C
Cybersecurity and Infrastructure Security Agency CISA
C
Cisco Blogs
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
The Hacker News
The Hacker News
Project Zero
Project Zero
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threatpost
V
Visual Studio Blog
The GitHub Blog
The GitHub Blog
The Cloudflare Blog
Last Week in AI
Last Week in AI
Jina AI
Jina AI
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
MongoDB | Blog
MongoDB | Blog
U
Unit 42
Scott Helme
Scott Helme
A
About on SuperTechFans
WordPress大学
WordPress大学
F
Fortinet All Blogs
大猫的无限游戏
大猫的无限游戏
G
GRAHAM CLULEY
Latest news
Latest news
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Schneier on Security

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