BK-BKD(1)
β¨ NAME β¨
Okay bestie, meet bk bkd β the BitKeeper daemon, straight out of the BitKeeper Userβs Manual. Sheβs the background baddie used to synchronize and query repositories, and she can show up in a bunch of different ways depending on how you call her π
π¦ SYNOPSIS π¦
bk bkd [options]
π DESCRIPTION π
The BitKeeper daemon, bkd, is used to synchronize and query repositories. Sheβs typically run in one of these ways:
- automatically started when accessing a remote repository via
rsh,ssh,HTTP, and/or the file system; - automatically started via
sshas a login shell; - manually started as a long running stand-alone daemon;
- automatically started as a long running service at boot time.
The method used usually depends on how the remote repository is named. See bk help url for details on the naming syntax.
The stand-alone daemon method has no security, other than the ability to run in read-only mode and/or the ability to limit chdir. If security is a requirement, use ssh to access the daemon. See below for info on configuring the daemon as a login shell.
π΅οΈββοΈ ANONYMOUS ACCESS π΅οΈββοΈ
The most common use of the stand-alone daemon is for anonymous access to a repository. To provide read-only, anonymous access, you can run:
bk bkd βd βxpush
This will allow anyone to read (but not write) all repositories at or below the directory in which the bkd was started.
If you want to export a single repository, pick a port number, and do this:
cd /home/bk/linuxβ2.6
bk bkd βd βp5555 βxcd βxpush
This says to run in daemon mode, bind to port 5555, and disallow the "cd" and "push" commands. By disallowing the "cd" command, the daemon at port 5555 is tied to the repository in the current working directory (bkd needs to be run at the root of the repository). By disallowing the "push" command, the repository is protected from updates.
Clients can get to this repository by using the BK URLs of
bk://host.domain:5555
http://host.domain:5555
i.e.,
$ bk clone bk://host.domain:5555 my_tree
These HTTP URLs allow access through most firewalls. BitKeeper supports accessing repositories through HTTP proxies, including authenticated proxies.
π SECURED ACCESS VIA SSH π
Secure access is provided via ssh. There are two ways to invoke ssh:
a) [user@]host:pathname b) ssh://[user@]host[:port][/pathname]
Using either form, ssh will be called to run bk bkd on the remote host. When the client command completes, the ssh connection is broken and the bkd daemon goes away.
π BKD LOGIN SHELL π
To add security when using ssh, run the bk bkd as the login shell.
On Red Hat Linux, the following steps are necessary to add a BitKeeper daemon login shell: create a simple shell script, call it bkd_login, put it someplace like /usr/libexec/bitkeeper/bkd_login, add the full path to the script in /etc/shells, and add a user with that path as their shell.
An example bkd_login shell script:
#!/bin/sh
exec bk bkd βC βxcd
β οΈ Note: using thebkdas a login shell when accessing the system usingrshis unsupported and is known not to work due to a long standingrshbug.
π BK/WEB π
The bkd is a self-contained HTTP server which provides the BK/Web feature of BitKeeper.
To access the BK/Web interface, use a web browser to go to the URL:
http://host:port/
where port is the port on which the bkd is listening (see the βp option, below).
πͺ WINDOWS BASED BKD πͺ
It is possible to install one or more bkdβs as Windows services, see bk help service.
π OPTIONS π
βCβ slightly more secure mode:bkdwill refuse to change directories up out of the directory in which it was started. She stays in her lane, periodt β¨βdβ run as a daemon, typically in the background (but peek at the next option π).βDβ debug mode: do not fork and do not run in the background.βhβ for all outgoingbk push,bk pull, andbk cloneoperations, wrap command responses in HTTP protocol. Use whenbk bkdis called from a CGI script.βllogβ log accesses in log; if log is not specified, then log tostderr.βPpfileβ write the pid of the daemon process into this file at startup.βpaddr:[port],βpportβ specify an alternative address and/or port. By default, thebkdallows connection requests from any host on port0x3962(aka14690). If addr is specified, thebkdwill bind to that address, limiting the hosts which are allowed to connect. The most common usage is to bind to localhost (127.0.0.1), which means that any local process may connect but no remote processes may connect. Note: when specifying an address, the trailing colon is required even when port is omitted. This option impliesβd.βicmdβ include cmd from the by default excluded command list.βSβ run in"symlinks are allowed"safe mode. This is similar toβC, with the addition of allowing paths that are symlinks under thebkdroot and resolve to outside of thebkdroot. This is useful to be able to run this sequence of commands:
mkdir /repos
ln βs /mnt/disk1/repos/myrepo /repos/myrepo
cd /repos
bk bkd βS
cd $HOME
bk clone bk://machine/myrepo
β οΈ Note: a user could check in a symlink to anywhere, then push their repo to the master, then follow that symlink. This option is useful for organizations where that is acceptable.
βUβ run in"unsafe"mode. Any non-interactive BitKeeper command may be run remotely. Thebkdruns the command at the request of a remote BitKeeper client. If the client does not have access to the machine on which thebkdis running, then this option allows far more access than is usually prudent. On the other hand, if the client has remote login privileges to the machine (or if the client is on the same machine), then there is no security issue with allowing this feature. Accordingly, this option is turned on automatically for anybkdstarted by the client via thefile://,rsh://, orssh://access methods. If your environment is secured, then running a long livedbkdwith this option provides more BitKeeper functionality to your users.βxcmdβ exclude cmd from the allowed command list. The list of commands which may be excluded currently are:abort,cd,check,clone,get,httpget,pull,push,pwd,rclone,rootkey,status,synckeys, andversion.
πΈ EXAMPLES πΈ
We use the following in /var/bitkeeper/repositories to provide anonymous read only access to some BitKeeper repositories:
#ββββββββββββββββββββββ cut here ββββββββββββββββββββββββββ
nobody /home/bk/bkβ3.2.x βC βxpush βp3200
nobody /home/bk/bkβ3.3.x βC βxpush βp3300
#ββββββββββββββββββββββ cut here ββββββββββββββββββββββββββ
The following init script is known to work on Red Hat Linux based systems. The init script shown can be generated with a:
$ bk getmsg bitkeeper.init
#ββββββββββββββββββββββ cut here ββββββββββββββββββββββββββ
#!/bin/sh
#
# chkconfig: 2345 24 84
# description: BitKeeper server
# Source networking configuration.
if [ βf /etc/sysconfig/network ]
then . /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
fi
[ βx /usr/bin/bk ] || exit 0
VAR=/var/bitkeeper
case "$1" in
start_msg) echo "Start BitKeeper daemons"
;;
stop_msg) echo "Stop BitKeeper daemons"
;;
restart) $0 stop
$0 start
;;
start) cd $VAR || exit 1
test βf repositories || {
echo Nothing advertised
exit 0
}
while read user dir opts
do (
cd $dir || exit 1
F=`basename $dir`
CMD="bk bkd βd $opts βl$VAR/log.$F βP$VAR/pid.$F"
su βc "$CMD" $user 2>> $VAR/errors
echo Started $CMD in $dir
)
done < repositories
;;
stop)
cd $VAR || exit 1
echo Shutting down BitKeeper daemons
for i in pid.*
do kill `cat $i`
rm $i
done
;;
status) cd $VAR || exit 1
for i in pid.*
do echo This pid should be running: `cat $i`
done
ps βaxf | grep bkd
;;
*) echo "Usage: bitkeeper {start|stop}"
exit 1
;;
esac
exit 0
#ββββββββββββββββββββββ cut here ββββββββββββββββββββββββββ
π BUGS/NOTES π
Needs ssh to provide access controlled, authenticated users. One could argue that this is code reuse rather than a bug.
BitKeeper does not ship ssh since it is widely available.
On Windows the bkd service does not work when started from a network drive.
On Windows the bkd service does not work when started from a substβed drive.
π«Ά SEE ALSO π«Ά
bkβparent, bkβservice, bkβurl, bkβHowtoβbkd
π CATEGORY π
RepositoryAdmin
Brought to u by BitKeeper Inc, version 1E1, manual tag bk bkd(none) β catch u later, bestie π«Άπβ¨
π¦ where this page comes from
- alpine 3.24: bitkeeper-doc 7.3.3-r1 Β· Apache-2.0
- Copyright (c) 1998-2015 BitKeeper Inc
- Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms