-2

I get the following error when i enter the command:

printf '#!/bin/bash\nxvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf -q $*' > /usr/bin/newwkhtmltopdf.sh

bash: /usr/bin/newwkhtmltopdf.sh: Permission denied.

I have tried the apt update and even when to the ubuntu packages platform to download the wkhtmlopdf package. Please can someone help me with this??

Jos
  • 29,224
  • As a regular user you are not allowed to write to /usr/bin. If your new script must reside in /usr/bin (e.g. because other users need it), use sudo. Otherwise, create the script in your $HOME. – Jos Mar 20 '23 at 11:02
  • 1
    Please tell us what you're trying to do and why. Where did you read about this? As a user without prior knowledge to Linux, this is not one of the first tasks to do... – pLumo Mar 20 '23 at 12:09

1 Answers1

1

The folder /usr/bin is owned by the root user (UID 0).

You need to have root privileges to write anything to this folder.

Writing to system folders should be done with much care. One way to do this would be to switch to the root user, using the command:

sudo -s

And then running your command. Afterwards, exit to switch back to your normal user.

Another option would be to place your user script inside the $HOME folder, as @Jos state in his comment.

Artur Meinild
  • 26,018
  • Can you please tell me how to do that? i have no prior knowledge in Ubuntu and related operations. I'll be pleased if you could give me some hints to follow inorder to get htese priviledges – Koji_422 Mar 20 '23 at 11:44
  • Thanks i did solve my problem using the command sudo -i to enable root priviledges thanks miuch – Koji_422 Mar 20 '23 at 12:14
  • Since you write you have no prior knowledge in Ubuntu, you are probably about to shoot yourself in the foot. Those permissions are restrictive for a reason. Please learn about the system first before you attempt to modify system files and directories; work in your home directory instead, then any damage you can cause will be limited. – HuHa Mar 20 '23 at 13:21