The Simplest Way to Make Bitbucket and CentOS Work Like They Should
Teams use bitbucket and centos to store code and run build jobs on Linux servers. A commit in the repo triggers a runner or SSH task on the host. This setup moves code from developer laptops to test and production hosts fast. Yet manual SSH keys and wide server rights often create big security gaps. A clean setup uses scoped keys, strict host roles, and clear audit logs. How bitbucket and centos share keys and data The source repo holds your app code and your build rules. The Linux server ru
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams use bitbucket and centos to store code and run build jobs on Linux servers. A commit in the repo triggers a runner or SSH task on the host.
This setup moves code from developer laptops to test and production hosts fast. Yet manual SSH keys and wide server rights often create big security gaps. A clean setup uses scoped keys, strict host roles, and clear audit logs.
How bitbucket and centos share keys and data
The source repo holds your app code and your build rules. The Linux server runs the build steps or hosts the live app. These two tools talk over SSH or HTTPS during each build run.
In a push model, the cloud runner opens an SSH session to the host. It uses a stored private key to log in as a local Linux user. Then it pulls the new code or copies build files over the network.
In a pull model, a runner agent lives right on the Linux host. The agent polls the repo service over HTTPS using an auth token. When a developer merges code, the agent grabs the job and runs it locally.
Both flows need careful key handling and clear user rules on the host. If the repo key has root rights, one bad script can wipe the server. Good teams map each repo to a single Linux user with minimal rights.
Common failure modes in repo to server links
Many teams share one SSH key across ten or twenty Linux hosts. Nobody knows which developer or pipeline ran a given shell command. When an engineer leaves the team, rotating that shared key breaks every build.
Broad tokens cause another big risk for build hosts. A personal token with full repo admin rights might sit on a test server. If an attacker reads that disk, they can steal all your source code.
Unlogged shell sessions also hurt ops teams during an outage. A pipeline script or a developer might change a system file by hand. Without command logs, the team wastes hours guessing what changed on the host.
End-to-End Encryption + Bitbucket Pipelines Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Network rules often stay too open between cloud runners and private servers. Opening the SSH port to the whole internet invites constant brute force attacks. Teams must lock firewall rules down to known runner IP lists or private links.
Scoping roles and network paths for safer builds
Start by creating a dedicated Linux user just for build and deploy tasks. Do not give this user full root rights across the whole operating system. Grant write permissions only to the specific folder where the app lives.
If the deploy job must restart a service, scope that rule tightly. Allow the build user to run only that single restart command without a password. Block all other admin commands so a broken script stays contained.
Use repo tokens or SSH keys that only work for one project. Set an expiration date on every token so old keys die on time. Store private keys in encrypted pipeline variables rather than inside repo files.
Keep the Linux host inside a private subnet whenever you can. Run a local build agent inside your network so it dials out over HTTPS. This choice removes the need to open inbound SSH ports to public networks.
Finally, turn on system audit logs on the Linux host to track changes. Record which user logged in, when they arrived, and what files they touched. Send those logs to a central store so no local user can erase them.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.
Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Should we push code over SSH or run a local build agent?
A local agent is safer for private servers because it uses outbound HTTPS. You do not have to open inbound SSH ports to cloud runner addresses.
How do we stop build scripts from taking over the Linux host?
Run the build or deploy under a standard Linux user with strict folder limits. Never give the pipeline user full sudo rights across the whole machine.
What is the best way to rotate repo keys on our servers?
Give each repo and server pair its own unique key with an expiry date. When you rotate a key, you only update one repo and one host.
Related guides
In this post