Skip to content

Commit

Permalink
Fix #1293: Permission denied on tarantoolctl enter
Browse files Browse the repository at this point in the history
  • Loading branch information
rtsisyk committed Feb 5, 2016
1 parent 93753cd commit ab186b9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
9 changes: 8 additions & 1 deletion extra/dist/tarantoolctl.in
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ local function wrapper_cfg(cfg)
require('fiber').name(instance_name)
log.info('Run console at %s', console_sock)
console.listen(console_sock)
-- gh-1293: members of `tarantool` group should be able to do `enter`
fio.chmod(console_sock, tonumber('0664', 8))

return res
end
Expand Down Expand Up @@ -536,7 +538,12 @@ elseif cmd == 'logrotate' then

elseif cmd == 'enter' then
if fio.stat(console_sock) == nil then
log.error("Can't connect to %s (socket not found)", console_sock)
local e = errno()
log.error("Can't connect to %s (%s)", console_sock, errno.strerror())
if not usermode and e == errno.EACCES then
log.error("Please add $USER to group '%s': useradd -a -G %s $USER",
group_name, group_name)
end
os.exit(-1)
end

Expand Down
3 changes: 3 additions & 0 deletions test/app/tarantoolctl.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TAP version 13
1..1
ok - gh1293: permission denied on tarantoolctl enter
17 changes: 17 additions & 0 deletions test/app/tarantoolctl.test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env tarantool

local test = require('tap').test('cfg')
test:plan(1)

-------------------------------------------------------------------------------
-- gh-1293: permission denied on tarantoolctl enter
-------------------------------------------------------------------------------

-- test-run uses tarantoolctl under the hood
local console_sock = 'box.control'
local mode = require('fio').stat(console_sock).mode
test:is(string.format("%o", mode), "140664",
"gh1293: permission denied on tarantoolctl enter")

test:check()
os.exit(0)

0 comments on commit ab186b9

Please sign in to comment.