Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Bad -c option

    Scheduled Pinned Locked Moved General pfSense Questions
    11 Posts 4 Posters 1.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      heper
      last edited by

      
      [2.3.4-RELEASE][root@pfsense]/root: su -m admin -c 'sh -c "df -h"'
      Filesystem     Size    Used   Avail Capacity  Mounted on
      /dev/da0s1a     50G    2.4G     44G     5%    /
      devfs          1.0K    1.0K      0B   100%    /dev
      /dev/md0       3.4M    148K    3.0M     5%    /var/run
      devfs          1.0K    1.0K      0B   100%    /var/dhcpd/dev
      [2.3.4-RELEASE][root@pfsense]/root: 
      
      

      seems to work for me

      1 Reply Last reply Reply Quote 0
      • H
        hayati
        last edited by

        Thanks for your reply,

        Yes, if you run command directly in related pfsense terminal (physical or virtual) it works.

        But if you access pfSense using ssh and run the same command you'll get "Bad -c option" error.

        su -m admin -c 'sh -c "df -h"'

        Bad -c option

        This is the problem, and I guess you run commands directly to your pfSense machine. If so, can you please give a try with ssh?

        Thanks,

        1 Reply Last reply Reply Quote 0
        • H
          heper
          last edited by

          That was from SSH session….

          1 Reply Last reply Reply Quote 0
          • H
            hayati
            last edited by

            Interesting, I can reproduce error everytime.

            Steps to reproduce:

            Setup : pfSense-CE-2.3.4-RELEASE-amd64.iso (fresh install), I used KVM.
            Just after installation and without any updates applied, I run previous command from SSH and KVM instance GUI.

            In SSH session, this error message can be seen every time I run command.

            I've updated to 2.3.4_1 and 2.4.0 problem is still there in both versions.

            Thanks,

            1 Reply Last reply Reply Quote 0
            • H
              heper
              last edited by

              try a different ssh client ? maybe some escape characters get fucked somehow ?

              1 Reply Last reply Reply Quote 0
              • H
                hayati
                last edited by

                I've tried with putty, gnome-terminal (on ubuntu 16.04), and MacOS terminal (all in different physical machines).

                They all gave same error.

                1 Reply Last reply Reply Quote 0
                • KOMK
                  KOM
                  last edited by

                  The problem is you have to be root for it to work.  If you login as admin, you get the error.

                  1 Reply Last reply Reply Quote 0
                  • H
                    hayati
                    last edited by

                    Yes, it DOES work with root.

                    Thank you so much. But, If admin is also a kind of (and actually is) root user (it has 0 id) why couldn't admin able to run this command?

                    Thanks,

                    1 Reply Last reply Reply Quote 0
                    • jimpJ
                      jimp Rebel Alliance Developer Netgate
                      last edited by

                      @hayati:

                      Yes, it DOES work with root.

                      Thank you so much. But, If admin is also a kind of (and actually is) root user (it has 0 id) why couldn't admin able to run this command?

                      Thanks,

                      The "admin" account shell is locked into the menu, it can't run commands like that (nor can it do scp)

                      Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                      Need help fast? Netgate Global Support!

                      Do not Chat/PM for help!

                      1 Reply Last reply Reply Quote 0
                      • H
                        hayati
                        last edited by

                        That makes sense.

                        Thanks all!

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.