Skip to main content
Tweeted twitter.com/#!/StackUnix/status/335366598573572097
added 28 characters in body
Source Link
daisy
  • 55.9k
  • 80
  • 253
  • 403

I'm trying to get a auto completion for folders that I don't have permission to view / enter, my first thought was to use compgen and sudo to do the completion manually, but looks like compgen is a shell builtin, so launching it with sudo may not work.

Also, if I wrote customized completion function for folders, how can I overwrite for every command? I don't want to do complete command for everything.

Or is there any alternative ways?

EDIT

This is useful in a environment where you grant user rootsudo permission (to run arbitrary commands), but don't want them to runlogin / su as root, so when they need to navigate to some folders accessible only by root, they can quickly view the contents without run commands like sudo ls XX

I'm trying to get a auto completion for folders that I don't have permission to view / enter, my first thought was to use compgen and sudo to do the completion manually, but looks like compgen is a shell builtin, so launching it with sudo may not work.

Also, if I wrote customized completion function for folders, how can I overwrite for every command? I don't want to do complete command for everything.

Or is there any alternative ways?

EDIT

This is useful in a environment where you grant user root permission, but don't want them to run as root, so when they need to navigate to some folders accessible only by root, they can quickly view the contents without run commands like sudo ls XX

I'm trying to get a auto completion for folders that I don't have permission to view / enter, my first thought was to use compgen and sudo to do the completion manually, but looks like compgen is a shell builtin, so launching it with sudo may not work.

Also, if I wrote customized completion function for folders, how can I overwrite for every command? I don't want to do complete command for everything.

Or is there any alternative ways?

EDIT

This is useful in a environment where you grant user sudo permission (to run arbitrary commands), but don't want them to login / su as root, so when they need to navigate to some folders accessible only by root, they can quickly view the contents without run commands like sudo ls XX

added 266 characters in body
Source Link
daisy
  • 55.9k
  • 80
  • 253
  • 403

I'm trying to get a auto completion for folders that I don't have permission to view / enter, my first thought was to use compgen and sudo to do the completion manually, but looks like compgen is a shell builtin, so launching it with sudo may not work.

Also, if I wrote customized completion function for folders, how can I overwrite for every command? I don't want to do complete command for everything.

Or is there any alternative ways?

EDIT

This is useful in a environment where you grant user root permission, but don't want them to run as root, so when they need to navigate to some folders accessible only by root, they can quickly view the contents without run commands like sudo ls XX

I'm trying to get a auto completion for folders that I don't have permission to view / enter, my first thought was to use compgen and sudo to do the completion manually, but looks like compgen is a shell builtin, so launching it with sudo may not work.

Also, if I wrote customized completion function for folders, how can I overwrite for every command? I don't want to do complete command for everything.

Or is there any alternative ways?

I'm trying to get a auto completion for folders that I don't have permission to view / enter, my first thought was to use compgen and sudo to do the completion manually, but looks like compgen is a shell builtin, so launching it with sudo may not work.

Also, if I wrote customized completion function for folders, how can I overwrite for every command? I don't want to do complete command for everything.

Or is there any alternative ways?

EDIT

This is useful in a environment where you grant user root permission, but don't want them to run as root, so when they need to navigate to some folders accessible only by root, they can quickly view the contents without run commands like sudo ls XX

Source Link
daisy
  • 55.9k
  • 80
  • 253
  • 403

Auto completion for inaccessible directories

I'm trying to get a auto completion for folders that I don't have permission to view / enter, my first thought was to use compgen and sudo to do the completion manually, but looks like compgen is a shell builtin, so launching it with sudo may not work.

Also, if I wrote customized completion function for folders, how can I overwrite for every command? I don't want to do complete command for everything.

Or is there any alternative ways?