1

This question is an exact duplicate of:

I've los the access to my root login so I've changed my password from grub. I still cant logg on and I need to use the chown -R command that I cant type in terminal. I have access to my server through WINSCP where I can browse through my files.

Can i make a script that will run sudo chown -R root /home/ngomm and paste under the already executable scripts in /etc/init.d ?

If yes what type of script will run this command and what script is already executable with I could paste my script under it.

marked as duplicate by Zanna, Anwar, Eric Carvalho, edwinksl, Pilot6 Aug 24 '16 at 8:07

This question was marked as an exact duplicate of an existing question.

  • 1
    Please don't open several/multiple posts for the same question. – dufte Aug 23 '16 at 7:02
0

chown is a command that allow you to change the permissions of a file, is not only for scripts, so you can use it with any tipe of files. I'll help you creating an script that will be executable ons tart up, but first you need to get your root password back (the post you posted before )

For creating a new script, tipe on terminal

sudo nano mynewscript.sh

And edit it. Make sure you start the script with #!bin/bash. Ctrl + x and save the file.

Now you must make it executable. Run

sudo chmod ugo+x mynewscript.sh

Where u means user, g groups and o owner.

For moving it to init.d run

sudo mv mynewscript.sh /etc/init.d/mynewscript.sh
  • i have my root password i can connect via WINSCP application and my root password but i don't have access to terminal so i have to paste that script under(OR above) a current executable script in init.d witch i can manipulate and that is it – Nima Bokhar Aug 23 '16 at 7:13
  • also thank you for your help i'll appreciate it – Nima Bokhar Aug 23 '16 at 7:14
  • Try to edit the script with notepad++, saving it as .sh and moving it to init.d – kek Aug 23 '16 at 7:15
  • ok i will so what type of script i will do the job – Nima Bokhar Aug 23 '16 at 7:21
  • I dont know what are you trying to do with the script, surf the net to edit your code. If it is correct, running the steps Ive post or using notepad will make it run correctly at startup. Ive never add any problem , so I cant help you more. – kek Aug 23 '16 at 7:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.